import { AXPWidgetsList } from '@acorex/modules/common';
import { createAllQueryView, AXPEntityQueryType } from '@acorex/platform/common';
import { AXPWidgetsCatalog } from '@acorex/platform/layout/widget-core';
import { d as AXMHumanCapitalManagementEmployeeSkillEntityService, R as RootConfig } from './acorex-modules-human-capital-management-acorex-modules-human-capital-management-cb1hY8I2.mjs';
import { entityMasterCrudActions, entityMasterRecordActions } from '@acorex/platform/layout/entity';

async function factory(injector) {
    const dataService = injector.get(AXMHumanCapitalManagementEmployeeSkillEntityService);
    const i18n = RootConfig.config.i18n;
    const entityName = 'employee-skill';
    const entityDef = {
        module: RootConfig.module.name,
        name: RootConfig.entities.employeeSkill.name,
        title: '@human-capital-management:employee-skill.individual-title',
        icon: RootConfig.entities.employeeSkill.icon,
        formats: {
            individual: '@human-capital-management:employee-skill.individual-title',
            plural: '@human-capital-management:employee-skill.plural-title',
            searchResult: { title: '{{ skill.title }} - {{ level }}', description: RootConfig.module.title },
        },
        groups: [
            { id: 'basic-info', title: '@human-capital-management:employee-skill.basic-info' },
            { id: 'validation', title: '@human-capital-management:employee-skill.validation' },
            { id: 'additional', title: '@human-capital-management:employee-skill.additional' },
        ],
        properties: [
            {
                name: 'employeeId',
                title: '@human-capital-management:employee-skill.employeeId',
                groupId: 'basic-info',
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsList.Editors.LookupBox,
                        options: {
                            entity: `HumanCapitalManagement.Employee`,
                            valueField: 'id',
                            textField: 'employeeCode',
                            look: 'select',
                            expose: [
                                { source: 'id', target: 'employee.id' },
                                { source: 'employeeCode', target: 'employee.employeeCode' },
                            ],
                        },
                    },
                },
                validations: [{ rule: 'required' }],
            },
            {
                name: 'skillId',
                title: '@human-capital-management:employee-skill.skillId',
                groupId: 'basic-info',
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsList.Editors.LookupBox,
                        options: {
                            entity: `${RootConfig.module.name}.${RootConfig.entities.skill.name}`,
                            valueField: 'id',
                            textField: 'title',
                            look: 'select',
                            expose: [
                                { source: 'id', target: 'skill.id' },
                                { source: 'title', target: 'skill.title' },
                            ],
                        },
                    },
                },
                options: { filter: { advance: { enabled: true }, inline: { enabled: true } }, sort: { enabled: true } },
                validations: [{ rule: 'required' }],
            },
            {
                name: 'levelId',
                title: '@human-capital-management:employee-skill.level',
                groupId: 'basic-info',
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsList.Editors.LookupBox,
                        options: {
                            entity: `${RootConfig.module.name}.${RootConfig.entities.skillLevel.name}`,
                            valueField: 'id',
                            textField: 'title',
                            look: 'select',
                            expose: [
                                { source: 'id', target: 'level.id' },
                                { source: 'title', target: 'level.title' },
                            ],
                        },
                    },
                },
                options: { filter: { advance: { enabled: true }, inline: { enabled: true } }, sort: { enabled: true } },
                validations: [{ rule: 'required' }],
            },
            { name: 'yearsOfExperience', title: '@human-capital-management:employee-skill.yearsOfExperience', groupId: 'basic-info', schema: { dataType: 'number', interface: { type: AXPWidgetsList.Editors.NumberBox, options: { minValue: 0, maxValue: 60, step: 1 } } }, options: { filter: { advance: { enabled: true }, inline: { enabled: true } }, sort: { enabled: true } } },
            { name: 'lastUsedDate', title: '@human-capital-management:employee-skill.lastUsedDate', groupId: 'basic-info', schema: { dataType: 'date', interface: { type: AXPWidgetsList.Editors.DateTimeBox } }, options: { filter: { advance: { enabled: true }, inline: { enabled: true } }, sort: { enabled: true } } },
            { name: 'validatedBy', title: '@human-capital-management:employee-skill.validatedBy', groupId: 'validation', schema: { dataType: 'string', interface: { type: AXPWidgetsCatalog.text } } },
            { name: 'validationSource', title: '@human-capital-management:employee-skill.validationSource', groupId: 'validation', schema: { dataType: 'string', interface: { type: AXPWidgetsCatalog.text } } },
            { name: 'validationDate', title: '@human-capital-management:employee-skill.validationDate', groupId: 'validation', schema: { dataType: 'date', interface: { type: AXPWidgetsList.Editors.DateTimeBox, options: { format: 'YYYY-MM-DD' } } } },
            { name: 'notes', title: '@human-capital-management:employee-skill.notes', groupId: 'additional', schema: { dataType: 'string', interface: { type: AXPWidgetsList.Editors.LargeTextBox, options: { rows: 3 } } } },
        ],
        columns: [
            { name: 'skillId', options: { dataPath: 'skill.title' } },
            { name: 'levelId', options: { dataPath: 'level.title' } },
            { name: 'yearsOfExperience' },
            { name: 'lastUsedDate' },
        ],
        commands: {
            create: { execute: async (data) => ({ id: await dataService.insertOne(data) }) },
            delete: { execute: async (id) => await dataService.deleteOne(id) },
            update: { execute: async (data) => await dataService.updateOne(data.id, data) },
        },
        queries: {
            byKey: { execute: async (id) => await dataService.getOne(id), type: AXPEntityQueryType.Single },
            list: { execute: async (e) => await dataService.query({ skip: e.skip, take: e.take, filter: e.filter }), type: AXPEntityQueryType.List },
        },
        interfaces: {
            master: {
                create: {
                    sections: [{ id: 'basic-info' }, { id: 'validation' }, { id: 'additional' }], properties: [
                        { name: 'skillId', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'levelId', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'yearsOfExperience', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'lastUsedDate', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'validatedBy', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'validationSource', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'validationDate', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'notes', layout: { positions: { lg: { colSpan: 12 } } } },
                    ]
                },
                update: {
                    sections: [{ id: 'basic-info' }, { id: 'validation' }, { id: 'additional' }], properties: [
                        { name: 'skillId', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'levelId', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'yearsOfExperience', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'lastUsedDate', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'validatedBy', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'validationSource', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'validationDate', layout: { positions: { lg: { colSpan: 6 } } } },
                        { name: 'notes', layout: { positions: { lg: { colSpan: 12 } } } },
                    ]
                },
                single: { title: 'Skill', sections: [{ id: 'basic-info' }, { id: 'validation' }, { id: 'additional' }], actions: [...entityMasterRecordActions()] },
                list: { actions: [...entityMasterCrudActions()], views: [createAllQueryView({ sorts: [{ name: 'levelId', dir: 'asc' }] })] },
            },
        },
    };
    return entityDef;
}

export { factory };
//# sourceMappingURL=acorex-modules-human-capital-management-employee-skill.entity-DfdiUEju.mjs.map
