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

async function factory(injector) {
    const dataService = injector.get(AXMHumanCapitalManagementSkillLevelEntityService);
    const i18n = RootConfig.config.i18n;
    const entityName = 'skill-level';
    const entityDef = {
        module: RootConfig.module.name,
        name: RootConfig.entities.skillLevel.name,
        title: '@human-capital-management:skill-level.individual-title',
        formats: {
            individual: '@human-capital-management:skill-level.individual-title',
            plural: '@human-capital-management:skill-level.plural-title',
            searchResult: { title: '{{ title }}', description: RootConfig.module.title },
        },
        groups: [
            { id: 'basic-info', title: '@human-capital-management:skill-level.basic-info' },
            { id: 'settings', title: '@human-capital-management:skill-level.settings' },
        ],
        properties: [
            { name: 'title', title: '@human-capital-management:skill-level.title', groupId: 'basic-info', schema: { dataType: 'string', interface: { type: AXPWidgetsCatalog.text } }, validations: [{ rule: 'required' }], options: { sort: { enabled: true }, filter: { advance: { enabled: true } } } },
            { name: 'isActive', title: '@human-capital-management:skill-level.is-active', groupId: 'settings', schema: { dataType: 'boolean', interface: { type: AXPWidgetsCatalog.toggle } } },
            { name: 'description', title: '@human-capital-management:skill-level.description', groupId: 'basic-info', schema: { dataType: 'string', interface: { type: AXPWidgetsCatalog.largeText } } },
        ],
        columns: [{ name: 'title' }, { name: 'order' }, { name: 'isActive' }],
        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: 'settings' }], properties: [{ name: 'title', layout: { positions: { lg: { colSpan: 6 } } } }, { name: 'description', layout: { positions: { lg: { colSpan: 12 } } } }] },
                update: { sections: [{ id: 'basic-info' }, { id: 'settings' }], properties: [{ name: 'title', layout: { positions: { lg: { colSpan: 6 } } } }, { name: 'isActive', layout: { positions: { lg: { colSpan: 3 } } } }, { name: 'description', layout: { positions: { lg: { colSpan: 12 } } } }] },
                single: { title: '{{title}}', sections: [{ id: 'basic-info' }, { id: 'settings' }], properties: [{ name: 'title', layout: { positions: { lg: { colSpan: 6 } } } }, { name: 'description', layout: { positions: { lg: { colSpan: 12 } } } }], actions: [entityMasterDeleteAction()] },
                list: { actions: [...entityMasterCrudActions()], views: [createAllQueryView({ sorts: [{ name: 'order', dir: 'asc' }] })] },
            },
        },
    };
    return entityDef;
}

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