import { ModalDependencyInjectionOptions } from '@siemens/element-ng/modal';
import { Observable } from 'rxjs';
import { TranslatableString } from '@siemens/element-translate-ng/translate';
import * as i0 from '@angular/core';

/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */

type AlertDialogResult = 'confirm';
type EditDiscardDialogResult = 'save' | 'discard' | 'cancel';
type ConfirmationDialogResult = 'confirm' | 'decline';
type DeleteConfirmationDialogResult = 'delete' | 'cancel';
/**
 * Base type for all action dialogs
 * @typeParam TResult - Type of the dialog result.
 */
interface ActionDialogBase<TResult> {
    /** The message. */
    message?: TranslatableString;
    /** The heading. */
    heading?: TranslatableString;
    /** Icon displayed in the heading. */
    icon?: string;
    /** Parameters for the translate pipe. */
    translationParams?: Record<string, any>;
    /**
     * Callback for delaying dismiss with a progress indicator until the
     * returned {@link Observable} emits.
     */
    delayDismiss?: (result: TResult) => Observable<TResult>;
}
/** An action dialog showing an alert */
interface AlertDialog extends ActionDialogBase<AlertDialogResult> {
    type: 'alert';
    /** Label of the confirmation button. */
    confirmBtnName?: TranslatableString;
}
/** An action dialog for a confirmation. */
interface ConfirmationDialog extends ActionDialogBase<ConfirmationDialogResult> {
    type: 'confirmation';
    /** Label of the confirmation button. */
    confirmBtnName?: TranslatableString;
    /** Label of the decline button. */
    declineBtnName?: TranslatableString;
}
/** An action dialog for an edit/discard prompt. */
interface EditDiscardDialog extends ActionDialogBase<EditDiscardDialogResult> {
    type: 'edit-discard';
    /** Whether to disable the save button. */
    disableSave?: boolean;
    /** Label of the save button. */
    saveBtnName?: TranslatableString;
    /** Label of the discard button. */
    discardBtnName?: TranslatableString;
    /** Label of the cancel button. */
    cancelBtnName?: TranslatableString;
    /** Message when {@link disableSave} is set. */
    disableSaveMessage?: TranslatableString;
    /** Label of the discard button when {@link disableSave} is set. */
    disableSaveDiscardBtnName?: TranslatableString;
}
/** An action dialog for a delete confirmation. */
interface DeleteConfirmationDialog extends ActionDialogBase<DeleteConfirmationDialogResult> {
    type: 'delete-confirm';
    /** Label of the delete button. */
    deleteBtnName?: TranslatableString;
    /** Label of the cancel button. */
    cancelBtnName?: TranslatableString;
}
/** All possible action dialogs. */
type ActionDialog = AlertDialog | ConfirmationDialog | EditDiscardDialog | DeleteConfirmationDialog | never;
/** Returns the return value type for the given action dialog type */
type ActionDialogReturnType<T extends ActionDialogBase<any>> = T extends AlertDialog ? AlertDialogResult : T extends ConfirmationDialog ? ConfirmationDialogResult : T extends EditDiscardDialog ? EditDiscardDialogResult : T extends DeleteConfirmationDialog ? DeleteConfirmationDialogResult : never;

/**
 * The service provides convenient methods to show common modal dialogs.
 * All return an observable, which emit the dialog results. After emitting,
 * the observables complete. Therefore, clients do not need to unsubscribe.
 */
declare class SiActionDialogService {
    private modalService;
    /**
     * Shows an action dialog
     * @param dialog - The dialog configuration
     * @param diOptions - Optional DI configuration.
     * @returns Observable for the result of the dialog. Need to `subscribe()` to show the dialog
     */
    showActionDialog<T extends ActionDialog>(dialog: T, diOptions?: ModalDependencyInjectionOptions): Observable<ActionDialogReturnType<T>>;
    static ɵfac: i0.ɵɵFactoryDeclaration<SiActionDialogService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<SiActionDialogService>;
}

export { SiActionDialogService };
export type { ActionDialog, ActionDialogReturnType, AlertDialog, AlertDialogResult, ConfirmationDialog, ConfirmationDialogResult, DeleteConfirmationDialog, DeleteConfirmationDialogResult, EditDiscardDialog, EditDiscardDialogResult };
