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 salesPipelineFactory(injector) {
    const i18n = RootConfig.config.i18n + ':opportunities.entities.sales-pipeline';
    const entityDef = {
        module: RootConfig.module.name,
        name: RootConfig.entities.salesPipeline.name,
        title: RootConfig.entities.salesPipeline.title,
        icon: RootConfig.entities.salesPipeline.icon,
        formats: {
            individual: RootConfig.entities.salesPipeline.title,
            plural: RootConfig.entities.salesPipeline.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: 'description', title: `@${i18n}.fields.description.title`, groupId: 'basic-info', schema: { dataType: 'string', interface: { type: AXPWidgetsCatalog.largeText, options: { rows: 3 } } } },
        ],
        columns: [{ name: 'title' }, { name: 'description' }],
        interfaces: {
            master: {
                create: {
                    sections: [{ id: 'basic-info' }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'description', layout: { positions: { lg: { colSpan: 12 } } } },
                    ],
                },
                update: {
                    sections: [{ id: 'basic-info' }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'description', layout: { positions: { lg: { colSpan: 12 } } } },
                    ],
                },
                single: {
                    title: '{{title}}',
                    sections: [{ id: 'basic-info', layout: { positions: { lg: { colSpan: 12 } } } }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
                        { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
                    ],
                    actions: [entityMasterDeleteAction()],
                },
                list: {
                    actions: [...entityMasterCrudActions()],
                    views: [createAllQueryView({ sorts: [{ name: 'title', dir: 'asc' }] })],
                },
            },
        },
    };
    return entityDef;
}

export { salesPipelineFactory };
//# sourceMappingURL=acorex-modules-customer-management-sales-pipeline.entity-Bsukn6ZT.mjs.map
