import { createAllQueryView, AXPEntityQueryType } from '@acorex/platform/common';
import { AXPWidgetsCatalog } from '@acorex/platform/layout/widget-core';
import { b as AXMHumanCapitalManagementSkillEntityService, 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(AXMHumanCapitalManagementSkillEntityService);
    const i18n = RootConfig.config.i18n;
    const entityName = 'skill';
    const entityDef = {
        module: RootConfig.module.name,
        name: RootConfig.entities.skill.name,
        plugins: [
            { name: 'history' },
            { name: 'lock' },
            { name: 'compare' },
            { name: 'category' },
            { name: 'tags' }
        ],
        title: '@human-capital-management:skill.individual-title',
        formats: {
            individual: '@human-capital-management:skill.individual-title',
            plural: '@human-capital-management:skill.plural-title',
            searchResult: { title: '{{ title }}', description: RootConfig.module.title },
        },
        relatedEntities: [],
        groups: [{ id: 'basic-info', title: '@human-capital-management:skill.basic-info' }],
        properties: [
            {
                name: 'title',
                title: '@human-capital-management:skill.title',
                groupId: 'basic-info',
                options: { sort: { enabled: true }, filter: { advance: { enabled: true }, inline: { enabled: false } } },
                schema: { dataType: 'string', interface: { type: AXPWidgetsCatalog.text } },
                validations: [{ rule: 'required' }],
            },
            {
                name: 'description',
                title: '@human-capital-management:skill.description',
                groupId: 'basic-info',
                schema: { dataType: 'string', interface: { type: AXPWidgetsCatalog.largeText } },
            },
        ],
        columns: [{ name: 'title' }, { name: 'description' }],
        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(e), type: AXPEntityQueryType.List },
        },
        interfaces: {
            master: {
                create: {
                    sections: [{ id: 'basic-info' }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
                        { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
                    ],
                },
                update: {
                    sections: [{ id: 'basic-info' }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
                        { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
                    ],
                },
                single: {
                    title: '{{title}}',
                    sections: [{ id: 'basic-info' }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
                        { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
                    ],
                    actions: [entityMasterDeleteAction()],
                },
                list: { actions: [...entityMasterCrudActions()], views: [createAllQueryView({ sorts: [{ name: 'name', dir: 'asc' }] })] },
            },
        },
    };
    return entityDef;
}

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