import { AXTranslationService } from '@acorex/core/translation';
import { AXPWidgetsCatalog } from '@acorex/platform/layout/widget-core';
import { inject } from '@angular/core';

var AXPAuthSettings;
(function (AXPAuthSettings) {
    AXPAuthSettings["TwoFactorAuth"] = "Auth:Setting:Authentication.TwoFactorAuth";
    AXPAuthSettings["PasswordComplexity"] = "Auth:Setting:Authentication.PasswordComplexity";
    AXPAuthSettings["PasswordExpiryDays"] = "Auth:Setting:Authentication.PasswordExpiryDays";
    AXPAuthSettings["MaxLoginAttempts"] = "Auth:Setting:Authentication.MaxLoginAttempts";
    AXPAuthSettings["LockoutDuration"] = "Auth:Setting:Authentication.LockoutDuration";
    AXPAuthSettings["SessionTimeout"] = "Auth:Setting:SessionManagement.SessionTimeout";
})(AXPAuthSettings || (AXPAuthSettings = {}));

class AXMSettingProvider {
    constructor() {
        this.translateService = inject(AXTranslationService);
    }
    async provide(context) {
        const trans = async (key) => await this.translateService.translateAsync(`@auth:settings.${key}`);
        context
            .addGroup('security-settings', await trans('title'), await trans('description'), 'fa-light fa-lock')
            // Authentication Section - Tenant Level
            .addSection('authentication', await trans('authentication.title'), await trans('authentication.description'))
            .addSetting({
            key: AXPAuthSettings.TwoFactorAuth,
            title: await trans('authentication.two-factor.title'),
            scope: 'T',
            isInherited: true,
            defaultValue: false,
            widget: {
                type: AXPWidgetsCatalog.toggle,
            },
            description: await trans('authentication.two-factor.description'),
        })
            .addSetting({
            key: AXPAuthSettings.PasswordComplexity,
            title: await trans('authentication.password.title'),
            scope: 'T',
            isInherited: true,
            defaultValue: 'Medium',
            widget: {
                type: AXPWidgetsCatalog.select,
                options: {
                    valueField: 'value',
                    textField: 'text',
                    dataSource: [
                        {
                            text: await trans('authentication.password.options.low'),
                            value: 'Low'
                        },
                        {
                            text: await trans('authentication.password.options.medium'),
                            value: 'Medium'
                        },
                        {
                            text: await trans('authentication.password.options.high'),
                            value: 'High'
                        },
                    ],
                },
            },
            description: await trans('authentication.password.description'),
        })
            .addSetting({
            key: AXPAuthSettings.PasswordExpiryDays,
            title: await trans('authentication.password-expiry.title'),
            scope: 'T',
            isInherited: true,
            defaultValue: 90,
            widget: {
                type: AXPWidgetsCatalog.number,
                options: {
                    minValue: 30,
                    maxValue: 365,
                    step: 1
                },
            },
            description: await trans('authentication.password-expiry.description'),
        })
            .addSetting({
            key: AXPAuthSettings.MaxLoginAttempts,
            title: await trans('authentication.max-attempts.title'),
            scope: 'T',
            isInherited: true,
            defaultValue: 5,
            widget: {
                type: AXPWidgetsCatalog.number,
                options: {
                    minValue: 3,
                    maxValue: 10,
                    step: 1
                },
            },
            description: await trans('authentication.max-attempts.description'),
        })
            .addSetting({
            key: AXPAuthSettings.LockoutDuration,
            title: await trans('authentication.lockout.title'),
            scope: 'T',
            isInherited: true,
            defaultValue: 15,
            widget: {
                type: AXPWidgetsCatalog.number,
                options: {
                    minValue: 5,
                    maxValue: 60,
                    step: 5
                },
            },
            description: await trans('authentication.lockout.description'),
        })
            .endSection()
            // Session Management - Tenant Level
            .addSection('session-management', await trans('session.title'), await trans('session.description'))
            .addSetting({
            key: AXPAuthSettings.SessionTimeout,
            title: await trans('session.timeout.title'),
            scope: 'T',
            isInherited: true,
            defaultValue: 5,
            widget: {
                type: AXPWidgetsCatalog.number,
                options: {
                    minValue: 5,
                    maxValue: 60,
                    step: 1,
                },
            },
            description: await trans('session.timeout.description'),
        })
            .endSection()
            .endGroup();
    }
}

export { AXMSettingProvider };
//# sourceMappingURL=acorex-modules-auth-settings.provider-DkhbuDBO.mjs.map
