import { Component, Inject } from '@angular/core';
import { MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA } from '@angular/material/legacy-dialog';
import * as i0 from "@angular/core";
import * as i1 from "@angular/material/legacy-dialog";
import * as i2 from "@angular/common";
import * as i3 from "@angular/forms";
import * as i4 from "@angular/material/legacy-form-field";
import * as i5 from "@angular/material/legacy-select";
import * as i6 from "@angular/material/legacy-core";
export class EnrollLanguageDialogueComponent {
    constructor(dialogRef, data) {
        this.dialogRef = dialogRef;
        this.data = data;
        this.languageList = [];
    }
    ngOnInit() {
        this.languageList = this.data.languageList || [];
        if (this.data.preSelect) {
            const preSelectIndex = this.languageList.findIndex((lang) => lang.langId === this.data.preSelect.langId);
            this.selectedLanguage = preSelectIndex !== -1 ? this.languageList[preSelectIndex] : null;
        }
        else {
            this.selectedLanguage = this.languageList.length > 0 ? this.languageList[0] : null;
        }
    }
    onLanguageChange($event) {
        console.log('Selected Language $event:', $event);
    }
    onSubmit() {
        if (this.selectedLanguage) {
            this.dialogRef.close(this.selectedLanguage); // Pass selected object to parent
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EnrollLanguageDialogueComponent, deps: [{ token: i1.MatLegacyDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: EnrollLanguageDialogueComponent, selector: "ws-app-enroll-language-dialogue", ngImport: i0, template: "<mat-dialog-content>\n    <div class=\"dialog-header text-left flex flex-col justify-between align-items-center\">\n        <p class=\"mat-subheading-1 text-center\">Choose Your Preferred Language</p>\n        <p class=\"mat-body-2 text-center\">This course is available in multiple languages. You can select one to begin.</p>\n    </div>\n    <div class=\"lang-msg-wrapper\">\n        <mat-form-field appearance=\"outline\" class=\"lang-select-wrapper\">\n            <mat-select [(ngModel)]=\"selectedLanguage\" (ngModelChange)=\"onLanguageChange($event)\" class=\"mat-body-1\">\n                <mat-option *ngFor=\"let lang of languageList\" [value]=\"lang\">\n                    {{ lang.name }}\n                </mat-option>\n            </mat-select>\n        </mat-form-field>\n\n        <div class=\"flex items-center justify-center\">\n            <a (click)=\"this.dialogRef.close()\" class=\"cursor-pointer mat-stroked-button custom-rounded margin-right-m\">Cancel</a>\n            <a (click)=\"onSubmit()\" class=\"cursor-pointer action-button\">Confirm & Start Course</a>\n        </div>\n    </div>\n</mat-dialog-content>\n", styles: [".lang-radio-btn{width:100%;margin-bottom:16px}.mat-form-field{width:100%}.custom-rounded{border:1px solid #1a4ca1!important;border-radius:50px;padding:8px 16px;height:40px;display:flex;align-items:center;justify-content:center;color:#1a4ca1!important}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i4.MatLegacyFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1.MatLegacyDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i5.MatLegacySelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i6.MatLegacyOption, selector: "mat-option", exportAs: ["matOption"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: EnrollLanguageDialogueComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ws-app-enroll-language-dialogue', template: "<mat-dialog-content>\n    <div class=\"dialog-header text-left flex flex-col justify-between align-items-center\">\n        <p class=\"mat-subheading-1 text-center\">Choose Your Preferred Language</p>\n        <p class=\"mat-body-2 text-center\">This course is available in multiple languages. You can select one to begin.</p>\n    </div>\n    <div class=\"lang-msg-wrapper\">\n        <mat-form-field appearance=\"outline\" class=\"lang-select-wrapper\">\n            <mat-select [(ngModel)]=\"selectedLanguage\" (ngModelChange)=\"onLanguageChange($event)\" class=\"mat-body-1\">\n                <mat-option *ngFor=\"let lang of languageList\" [value]=\"lang\">\n                    {{ lang.name }}\n                </mat-option>\n            </mat-select>\n        </mat-form-field>\n\n        <div class=\"flex items-center justify-center\">\n            <a (click)=\"this.dialogRef.close()\" class=\"cursor-pointer mat-stroked-button custom-rounded margin-right-m\">Cancel</a>\n            <a (click)=\"onSubmit()\" class=\"cursor-pointer action-button\">Confirm & Start Course</a>\n        </div>\n    </div>\n</mat-dialog-content>\n", styles: [".lang-radio-btn{width:100%;margin-bottom:16px}.mat-form-field{width:100%}.custom-rounded{border:1px solid #1a4ca1!important;border-radius:50px;padding:8px 16px;height:40px;display:flex;align-items:center;justify-content:center;color:#1a4ca1!important}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.MatLegacyDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }]; } });
//# sourceMappingURL=data:application/json;base64, 