import { ButtonComponent } from '@agorapulse/ui-components/button';
import { ModalComponent } from '@agorapulse/ui-components/modal';
import * as i0 from '@angular/core';
import { Input, ChangeDetectionStrategy, Component } from '@angular/core';
import * as i1 from '@angular/material/dialog';

class ConfirmModalComponent {
    dialogRef;
    contentText = '';
    footerCancelButtonId = 'cancel';
    footerCancelButtonLabel = '';
    footerConfirmButtonId = 'confirm';
    footerConfirmButtonLabel = '';
    headerTitle = '';
    constructor(dialogRef) {
        this.dialogRef = dialogRef;
        dialogRef.disableClose = true;
    }
    onCancel() {
        this.dialogRef.close(false);
    }
    onConfirm() {
        this.dialogRef.close(true);
    }
    static open(dialog, confirmModalTexts, modalConfig = null) {
        if (!modalConfig) {
            modalConfig = {};
        }
        if (!modalConfig.matDialogConfig) {
            modalConfig.matDialogConfig = {
                width: '550px',
            };
        }
        const confirmModal = ModalComponent.openDialog(dialog, modalConfig, ConfirmModalComponent);
        confirmModal.componentInstance.contentText = confirmModalTexts.contentText;
        confirmModal.componentInstance.footerConfirmButtonId = confirmModalTexts.footerConfirmButtonId;
        confirmModal.componentInstance.footerConfirmButtonLabel = confirmModalTexts.footerConfirmButtonLabel;
        confirmModal.componentInstance.footerCancelButtonId = confirmModalTexts.footerCancelButtonId;
        confirmModal.componentInstance.footerCancelButtonLabel = confirmModalTexts.footerCancelButtonLabel;
        confirmModal.componentInstance.headerTitle = confirmModalTexts.headerTitle;
        return confirmModal;
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ConfirmModalComponent, deps: [{ token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: ConfirmModalComponent, isStandalone: true, selector: "ap-confirm-modal", inputs: { contentText: "contentText", footerCancelButtonId: "footerCancelButtonId", footerCancelButtonLabel: "footerCancelButtonLabel", footerConfirmButtonId: "footerConfirmButtonId", footerConfirmButtonLabel: "footerConfirmButtonLabel", headerTitle: "headerTitle" }, ngImport: i0, template: "<ng-template #headerTemplate>\n    <h2>{{ headerTitle }}</h2>\n</ng-template>\n\n<ng-template #mainTemplate>\n    <p>{{ contentText }}</p>\n</ng-template>\n\n<ng-template #footerTemplate>\n    <div class=\"buttons\">\n        <ap-button\n            name=\"confirm-modal-cancel-button\"\n            [config]=\"{\n                style: 'ghost',\n                color: 'grey'\n            }\"\n            [id]=\"footerCancelButtonId\"\n            (click)=\"onCancel()\">\n            <span>\n                {{ footerCancelButtonLabel }}\n            </span>\n        </ap-button>\n        <ap-button\n            name=\"confirm-modal-confirm-button\"\n            cdkFocusInitial\n            [config]=\"{\n                style: 'primary',\n                color: 'orange'\n            }\"\n            [id]=\"footerConfirmButtonId\"\n            (click)=\"onConfirm()\">\n            <span>\n                {{ footerConfirmButtonLabel }}\n            </span>\n        </ap-button>\n    </div>\n</ng-template>\n\n<ap-modal\n    [closable]=\"true\"\n    [headerTemplate]=\"headerTemplate\"\n    [mainTemplate]=\"mainTemplate\"\n    [footerTemplate]=\"footerTemplate\" />\n", styles: [".buttons{display:flex;gap:var(--ref-spacing-sm)}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "ap-button", inputs: ["ariaLabel", "disabled", "name", "form", "config", "loading", "locked", "menuTrigger", "symbolPosition", "symbolId"], outputs: ["menuOpened", "menuClosed", "click", "focus", "blur"] }, { kind: "component", type: ModalComponent, selector: "ap-modal", inputs: ["closable", "headerBottomBorderEnabled", "footerTemplate", "footerVisible", "headerTemplate", "headerVisible", "mainTemplate", "sidePaneTemplate", "sidePaneStyle", "containerStyle", "headerStyle", "contentStyle", "footerStyle", "defaultLayout"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: ConfirmModalComponent, decorators: [{
            type: Component,
            args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'ap-confirm-modal', imports: [ButtonComponent, ModalComponent], template: "<ng-template #headerTemplate>\n    <h2>{{ headerTitle }}</h2>\n</ng-template>\n\n<ng-template #mainTemplate>\n    <p>{{ contentText }}</p>\n</ng-template>\n\n<ng-template #footerTemplate>\n    <div class=\"buttons\">\n        <ap-button\n            name=\"confirm-modal-cancel-button\"\n            [config]=\"{\n                style: 'ghost',\n                color: 'grey'\n            }\"\n            [id]=\"footerCancelButtonId\"\n            (click)=\"onCancel()\">\n            <span>\n                {{ footerCancelButtonLabel }}\n            </span>\n        </ap-button>\n        <ap-button\n            name=\"confirm-modal-confirm-button\"\n            cdkFocusInitial\n            [config]=\"{\n                style: 'primary',\n                color: 'orange'\n            }\"\n            [id]=\"footerConfirmButtonId\"\n            (click)=\"onConfirm()\">\n            <span>\n                {{ footerConfirmButtonLabel }}\n            </span>\n        </ap-button>\n    </div>\n</ng-template>\n\n<ap-modal\n    [closable]=\"true\"\n    [headerTemplate]=\"headerTemplate\"\n    [mainTemplate]=\"mainTemplate\"\n    [footerTemplate]=\"footerTemplate\" />\n", styles: [".buttons{display:flex;gap:var(--ref-spacing-sm)}\n"] }]
        }], ctorParameters: () => [{ type: i1.MatDialogRef }], propDecorators: { contentText: [{
                type: Input
            }], footerCancelButtonId: [{
                type: Input
            }], footerCancelButtonLabel: [{
                type: Input
            }], footerConfirmButtonId: [{
                type: Input
            }], footerConfirmButtonLabel: [{
                type: Input
            }], headerTitle: [{
                type: Input
            }] } });

/**
 * Generated bundle index. Do not edit.
 */

export { ConfirmModalComponent };
//# sourceMappingURL=agorapulse-ui-components-confirm-modal.mjs.map
