import { AXPWidgetsCatalog } from '@acorex/platform/layout/widget-core';
import { R as RootConfig } from './acorex-modules-form-template-management-acorex-modules-form-template-management-DCKQMU5_.mjs';
import { AXTranslationService } from '@acorex/core/translation';

var AXPFormTemplateSettings;
(function (AXPFormTemplateSettings) {
    AXPFormTemplateSettings["HistoryPanel"] = "form-template:designer:history-panel";
    AXPFormTemplateSettings["AutoSave"] = "form-template:designer:auto-save";
    AXPFormTemplateSettings["AutoSaveInterval"] = "form-template:designer:auto-save-interval";
    AXPFormTemplateSettings["AutoSaveTimeout"] = "form-template:designer:auto-save-timeout";
})(AXPFormTemplateSettings || (AXPFormTemplateSettings = {}));

class AXMSettingProvider {
    constructor(injector) {
        this.injector = injector;
        this.translateService = this.injector.get(AXTranslationService);
    }
    async provide(context) {
        const trans = async (key) => await this.translateService.translateAsync(`settings.form-template.${key}`, { scope: 'form-template-management' });
        context
            // Add Form Template Group
            .addGroup('form-template', await trans('title'), await trans('description'), RootConfig.module.icon)
            // Start Interface Section
            .addSection('designer', await trans('designer.title'), await trans('designer.description'))
            .addSetting({
            key: AXPFormTemplateSettings.HistoryPanel,
            title: await trans('designer.history-panel.title'),
            scope: 'U',
            isInherited: true,
            defaultValue: false,
            widget: {
                type: AXPWidgetsCatalog.toggle,
            },
            description: await trans('designer.history-panel.description'),
            validationRules: [
                {
                    rule: 'required',
                },
            ],
        })
            .addSetting({
            key: AXPFormTemplateSettings.AutoSave,
            title: await trans('designer.auto-save.title'),
            scope: 'U',
            isInherited: true,
            defaultValue: false,
            widget: {
                type: AXPWidgetsCatalog.toggle,
            },
            description: await trans('designer.auto-save.description'),
        })
            .addSetting({
            key: AXPFormTemplateSettings.AutoSaveInterval,
            title: await trans('designer.auto-save-interval.title'),
            scope: 'U',
            isInherited: true,
            defaultValue: 1,
            widget: {
                type: AXPWidgetsCatalog.number,
                options: {
                    visibility: `{{ context.eval('designer.auto-save') }}`,
                    hasClearButton: false,
                    minValue: 1,
                    maxValue: 60,
                }
            },
            description: await trans('designer.auto-save-interval.description'),
        })
            .endSection()
            // End Form Template Group
            .endGroup();
    }
}

export { AXMSettingProvider };
//# sourceMappingURL=acorex-modules-form-template-management-settings.provider-Ds18e881.mjs.map
