import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ModalButton } from './modal-data.model';
import * as i0 from "@angular/core";
import * as i1 from "@angular/material/dialog";
import * as i2 from "@angular/common";
import * as i3 from "@angular/material/button";
import * as i4 from "@angular/material/icon";
import * as i5 from "@angular/material/divider";
import * as i6 from "../icon/icon.component";
/**
 * Modal content component
 */
export class ModalContentComponent {
    constructor(dialogRef, data) {
        this.dialogRef = dialogRef;
        this.data = data;
    }
    ngOnInit() {
        // Treat button options
        this.buttonCancel = this.manageButton(this.data.cancel);
        this.buttonConfirm = this.manageButton(this.data.confirm, 'primary');
    }
    onCancelClick() {
        this.dialogRef.close({
            id: this.data.id,
            result: false
        });
    }
    onConfirmClick() {
        this.dialogRef.close({
            id: this.data.id,
            result: true
        });
    }
    manageButton(button, defaultColor) {
        const newButton = new ModalButton();
        if (typeof button === 'string') {
            newButton.text = button;
            newButton.color = defaultColor;
        }
        if (typeof button === 'object') {
            newButton.text = button.text;
            newButton.color = button.color;
            newButton.icon = button.icon;
        }
        return newButton;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ModalContentComponent, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: ModalContentComponent, selector: "ng-component", ngImport: i0, template: "@if (data.title) {\n<h3 mat-dialog-title class=\"flex flex-row\">\n  <span class=\"flex-1\">{{ data.title }}</span>\n  <button mat-icon-button class=\"mic-icon-button-large\" aria-label=\"Close modal\" (click)=\"onCancelClick()\">\n    <mat-icon aria-hidden=\"false\" aria-hidden=\"false\" role=\"img\" aria-label=\"close modal\">close</mat-icon>\n  </button>\n</h3>\n} @if (data.content) {\n<mat-dialog-content micScrollBar>\n  <ng-template [ngTemplateOutlet]=\"data.content\"></ng-template>\n</mat-dialog-content>\n} @if (data.cancel || data.confirm) {\n<mat-divider></mat-divider>\n} @if (data.cancel || data.confirm) {\n<mat-dialog-actions class=\"flex flex-row align-end\">\n  @if (data.cancel) {\n  <button mat-flat-button mat-dialog-close [color]=\"buttonCancel.color\" (click)=\"onCancelClick()\" tabindex=\"0\">\n    @if (buttonCancel?.icon) {\n    <mic-icon [icon]=\"buttonCancel.icon\"></mic-icon>\n    }\n    <span>{{ buttonCancel.text }}</span>\n  </button>\n  } @if (data.confirm) {\n  <button mat-flat-button [color]=\"buttonConfirm.color\" (click)=\"onConfirmClick()\" tabindex=\"0\">\n    @if (buttonConfirm?.icon) {\n    <mic-icon [icon]=\"buttonConfirm.icon\"></mic-icon>\n    }\n    <span>{{ buttonConfirm.text }}</span>\n  </button>\n  }\n</mat-dialog-actions>\n}\n", styles: [":host{padding:24px 0}::ng-deep .mat-mdc-dialog-surface{overflow:hidden;border-radius:8px!important}.mat-mdc-dialog-title{font-size:24px;font-weight:700;margin:0;display:flex}.mat-divider{margin:24px -24px 0}.mat-mdc-dialog-content{color:inherit}.mat-mdc-dialog-actions{padding:0;margin-bottom:-20px;justify-content:end}.mat-mdc-dialog-actions button{margin:16px 16px 16px 0}\n"], dependencies: [{ kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.MatButton, selector: "    button[mat-button], button[mat-raised-button], button[mat-flat-button],    button[mat-stroked-button]  ", exportAs: ["matButton"] }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "component", type: i6.IconComponent, selector: "mic-icon", inputs: ["icon", "fontSet", "ariaLabel", "decorative"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ModalContentComponent, decorators: [{
            type: Component,
            args: [{ template: "@if (data.title) {\n<h3 mat-dialog-title class=\"flex flex-row\">\n  <span class=\"flex-1\">{{ data.title }}</span>\n  <button mat-icon-button class=\"mic-icon-button-large\" aria-label=\"Close modal\" (click)=\"onCancelClick()\">\n    <mat-icon aria-hidden=\"false\" aria-hidden=\"false\" role=\"img\" aria-label=\"close modal\">close</mat-icon>\n  </button>\n</h3>\n} @if (data.content) {\n<mat-dialog-content micScrollBar>\n  <ng-template [ngTemplateOutlet]=\"data.content\"></ng-template>\n</mat-dialog-content>\n} @if (data.cancel || data.confirm) {\n<mat-divider></mat-divider>\n} @if (data.cancel || data.confirm) {\n<mat-dialog-actions class=\"flex flex-row align-end\">\n  @if (data.cancel) {\n  <button mat-flat-button mat-dialog-close [color]=\"buttonCancel.color\" (click)=\"onCancelClick()\" tabindex=\"0\">\n    @if (buttonCancel?.icon) {\n    <mic-icon [icon]=\"buttonCancel.icon\"></mic-icon>\n    }\n    <span>{{ buttonCancel.text }}</span>\n  </button>\n  } @if (data.confirm) {\n  <button mat-flat-button [color]=\"buttonConfirm.color\" (click)=\"onConfirmClick()\" tabindex=\"0\">\n    @if (buttonConfirm?.icon) {\n    <mic-icon [icon]=\"buttonConfirm.icon\"></mic-icon>\n    }\n    <span>{{ buttonConfirm.text }}</span>\n  </button>\n  }\n</mat-dialog-actions>\n}\n", styles: [":host{padding:24px 0}::ng-deep .mat-mdc-dialog-surface{overflow:hidden;border-radius:8px!important}.mat-mdc-dialog-title{font-size:24px;font-weight:700;margin:0;display:flex}.mat-divider{margin:24px -24px 0}.mat-mdc-dialog-content{color:inherit}.mat-mdc-dialog-actions{padding:0;margin-bottom:-20px;justify-content:end}.mat-mdc-dialog-actions button{margin:16px 16px 16px 0}\n"] }]
        }], ctorParameters: () => [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }] });
//# sourceMappingURL=data:application/json;base64, 