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 bodyPartFactory(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.bodyPart.name,
        title: RootConfig.entities.bodyPart.title,
        icon: RootConfig.entities.bodyPart.icon,
        formats: {
            individual: RootConfig.entities.bodyPart.title,
            plural: RootConfig.entities.bodyPart.titlePlural,
            searchResult: { title: '{{ title }}', description: RootConfig.module.title },
        },
        plugins: [{ name: 'history' }, { name: 'compare' }, { name: 'clone' }],
        groups: [{ id: 'basic-info', title: '@health-core:body-parts.entities.body-part.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:body-parts.entities.body-part.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:body-parts.entities.body-part.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 { bodyPartFactory };
//# sourceMappingURL=acorex-modules-health-core-body-part.entity-Dc2SIiB3.mjs.map
