import { createAllQueryView } from '@acorex/platform/common';
import { AXPWidgetsCatalog } from '@acorex/platform/layout/widget-core';
import { RootConfig } from './acorex-modules-customer-management.mjs';
import { entityMasterCrudActions, entityMasterDeleteAction } from '@acorex/platform/layout/entity';

async function opportunityStageFactory(injector) {
    const i18n = RootConfig.config.i18n + ':opportunities.entities.opportunity-stage';
    const entityDef = {
        module: RootConfig.module.name,
        name: RootConfig.entities.opportunityStage.name,
        title: RootConfig.entities.opportunityStage.title,
        icon: RootConfig.entities.opportunityStage.icon,
        formats: {
            individual: RootConfig.entities.opportunityStage.title,
            plural: RootConfig.entities.opportunityStage.titlePlural,
            searchResult: { title: '{{ title }}', description: RootConfig.module.title },
        },
        groups: [{ id: 'basic-info', title: `@${i18n}.groups.basic-info` }],
        properties: [
            { name: 'title', title: `@${i18n}.fields.title.title`, groupId: 'basic-info', schema: { dataType: 'string', interface: { type: AXPWidgetsCatalog.text } }, validations: [{ rule: 'required' }] },
            { name: 'probability', title: `@${i18n}.fields.probability.title`, groupId: 'basic-info', schema: { dataType: 'number', interface: { type: AXPWidgetsCatalog.number, options: { minValue: 0, maxValue: 100 } } } },
        ],
        columns: [{ name: 'title' }, { name: 'probability' }],
        interfaces: {
            master: {
                create: {
                    sections: [{ id: 'basic-info' }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'probability', layout: { positions: { lg: { colSpan: 3 } } } },
                    ],
                },
                update: {
                    sections: [{ id: 'basic-info' }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'probability', layout: { positions: { lg: { colSpan: 3 } } } },
                    ],
                },
                single: {
                    title: '{{title}}',
                    sections: [{ id: 'basic-info', layout: { positions: { lg: { colSpan: 12 } } } }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
                        { name: 'probability', layout: { positions: { lg: { colSpan: 3, order: 2 } } } },
                    ],
                    actions: [entityMasterDeleteAction()],
                },
                list: {
                    actions: [...entityMasterCrudActions()],
                    views: [createAllQueryView({ sorts: [{ name: 'title', dir: 'asc' }] })],
                },
            },
        },
    };
    return entityDef;
}

export { opportunityStageFactory };
//# sourceMappingURL=acorex-modules-customer-management-opportunity-stage.entity-CTTDLeNh.mjs.map
