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

async function factory(injector) {
    const i18n = RootConfig.config.i18n;
    const entityName = 'business-unit-type';
    const entityDef = {
        module: RootConfig.module.name,
        name: RootConfig.entities.businessUnitType.name,
        title: '@organization-management:business-unit-types.entities.business-unit-type.title',
        icon: 'fa-light fa-tags',
        formats: {
            individual: '@organization-management:business-unit-types.entities.business-unit-type.title',
            plural: '@organization-management:business-unit-types.entities.business-unit-type.plural',
            searchResult: { title: '{{ title }}', description: RootConfig.module.title },
        },
        groups: [{ id: 'basic-info', title: '@general:terms.interface.basic-info' }],
        properties: [
            {
                name: 'id',
                title: 'ID',
                groupId: 'basic-info',
                schema: { dataType: 'uuid', visible: false, nullable: false, readonly: true, unique: { enabled: true } },
            },
            {
                name: 'title',
                title: '@general:terms.common.title',
                groupId: 'basic-info',
                schema: { dataType: 'string', interface: { type: AXPWidgetsCatalog.text } },
                validations: [{ rule: 'required' }],
            },
            {
                name: 'name',
                title: '@general:terms.common.name',
                groupId: 'basic-info',
                schema: { dataType: 'string', interface: { type: AXPWidgetsCatalog.text } },
                validations: [{ rule: 'required' }],
            },
            {
                name: 'isLocationBased',
                title: '@organization-management:business-unit-types.entities.business-unit-type.fields.is-location-based.title',
                groupId: 'basic-info',
                schema: { dataType: 'boolean', interface: { type: AXPWidgetsCatalog.toggle }, defaultValue: false },
            },
        ],
        columns: [{ name: 'title' }, { name: 'name' }, { name: 'isLocationBased' }],
        interfaces: {
            master: {
                create: {
                    sections: [{ id: 'basic-info' }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'name', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'isLocationBased', layout: { positions: { lg: { colSpan: 12 } } } },
                    ],
                },
                update: {
                    sections: [{ id: 'basic-info' }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'name', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'isLocationBased', layout: { positions: { lg: { colSpan: 12 } } } },
                    ],
                },
                single: {
                    title: '{{title}}',
                    sections: [{ id: 'basic-info' }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'name', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'isLocationBased', layout: { positions: { lg: { colSpan: 12 } } } },
                    ],
                    actions: [...entityMasterRecordActions()],
                },
                list: {
                    actions: [...entityMasterCrudActions()],
                    views: [createAllQueryView({ sorts: [{ name: 'title', dir: 'asc' }] })],
                },
            },
        },
    };
    return entityDef;
}

export { factory };
//# sourceMappingURL=acorex-modules-organization-management-business-unit-type.entity-Dx7cb4Js.mjs.map
