import { AXTranslationService } from '@acorex/core/translation';
import { AXPWidgetsList } from '@acorex/modules/common';
import { inject } from '@angular/core';
import { RootConfig } from './acorex-modules-order-management.mjs';

//#region ----   Settings Keys   ----
/**
 * Order Management Settings Keys
 * Follows pattern: OrderManagement:Setting:{Category}.{SettingName}
 */
var AXMOrderManagementSettings;
(function (AXMOrderManagementSettings) {
    AXMOrderManagementSettings["TaxRate"] = "OrderManagement:Setting:BulkBuy.TaxRate";
})(AXMOrderManagementSettings || (AXMOrderManagementSettings = {}));
//#endregion

//#region ----   Imports   ----
//#endregion
//#region ----   Settings Provider   ----
class AXMOrderManagementSettingProvider {
    constructor() {
        this.translateService = inject(AXTranslationService);
    }
    async provide(context) {
        const trans = async (key) => await this.translateService.translateAsync(`@${RootConfig.config.i18n}:bulk-buy-orders.settings.${key}`);
        context
            .addGroup('bulk-buy', await trans('bulk-buy.title'), await trans('bulk-buy.description'), RootConfig.module.icon)
            .addSection('tax', await trans('tax.title'), await trans('tax.description'))
            .addSetting({
            key: AXMOrderManagementSettings.TaxRate,
            title: await trans('tax.items.tax-rate.title'),
            scope: 'T',
            isInherited: true,
            defaultValue: 15,
            widget: {
                type: AXPWidgetsList.Editors.NumberBox,
                options: {
                    minValue: 0,
                    maxValue: 100,
                    decimals: 2,
                },
            },
            description: await trans('tax.items.tax-rate.description'),
            validationRules: [
                {
                    rule: 'required',
                },
                {
                    rule: 'minValue',
                    options: {
                        value: 0,
                    },
                },
                {
                    rule: 'maxValue',
                    options: {
                        value: 100,
                    },
                },
            ],
        })
            .endSection()
            .endGroup();
    }
}
//#endregion

export { AXMOrderManagementSettingProvider };
//# sourceMappingURL=acorex-modules-order-management-settings.provider-BzNJIZCu.mjs.map
