import { AXPWidgetsList } from '@acorex/modules/common';
import { createAllQueryView } from '@acorex/platform/common';
import { entityMasterCrudActions, entityMasterRecordActions } from '@acorex/platform/layout/entity';
import { RootConfig } from './acorex-modules-health-core.mjs';

//#region ----   Imports   ----
//#endregion
//#region ----   Entity Factory   ----
async function injuryTypeFactory(injector) {
    const sections = [{ id: 'basic-info', layout: { positions: { lg: { colSpan: 12 } } } }];
    const propertyLayouts = [
        { name: 'title', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
        { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 2 } } } },
    ];
    const entityDef = {
        module: RootConfig.module.name,
        name: RootConfig.entities.injuryType.name,
        title: RootConfig.entities.injuryType.title,
        icon: RootConfig.entities.injuryType.icon,
        formats: {
            individual: RootConfig.entities.injuryType.title,
            plural: RootConfig.entities.injuryType.titlePlural,
            searchResult: { title: '{{ title }}', description: RootConfig.module.title },
        },
        plugins: [{ name: 'history' }, { name: 'compare' }, { name: 'clone' }],
        groups: [{ id: 'basic-info', title: '@health-core:injury-types.entities.injury-type.groups.basic-info' }],
        properties: [
            { name: 'id', title: '@general:terms.common.id', groupId: 'basic-info', schema: { dataType: 'uuid', visible: false, readonly: true, unique: { enabled: true } } },
            {
                name: 'title',
                title: '@general:terms.common.title',
                groupId: 'basic-info',
                options: { sort: { enabled: true }, filter: { advance: { enabled: true }, inline: { enabled: true } } },
                schema: {
                    dataType: 'string',
                    interface: { type: AXPWidgetsList.Editors.TextBox, options: { placeholder: '@health-core:injury-types.entities.injury-type.fields.title.placeholder' } },
                },
                validations: [{ rule: 'required' }],
            },
            {
                name: 'description',
                title: '@general:terms.common.description',
                groupId: 'basic-info',
                schema: {
                    dataType: 'string',
                    interface: { type: AXPWidgetsList.Editors.LargeTextBox, options: { rows: 3, placeholder: '@health-core:injury-types.entities.injury-type.fields.description.placeholder' } },
                },
            },
        ],
        columns: [{ name: 'title', options: { width: '220px', order: 1 } }],
        interfaces: {
            master: {
                create: { sections, properties: propertyLayouts },
                update: { sections, properties: propertyLayouts },
                single: { title: '{{ title }}', sections, properties: propertyLayouts, actions: [...entityMasterRecordActions()] },
                list: { actions: [...entityMasterCrudActions()], views: [createAllQueryView({ sorts: [{ name: 'title', dir: 'asc' }] })] },
            },
        },
    };
    return entityDef;
}
//#endregion

export { injuryTypeFactory };
//# sourceMappingURL=acorex-modules-health-core-injury-type.entity-BUA1VsE_.mjs.map
