import { createAllQueryView } from '@acorex/platform/common';
import { entityMasterCrudActions, entityMasterDeleteAction, entityDetailsCrudActions, entityDetailsSimpleCondition } from '@acorex/platform/layout/entity';
import { AXPWidgetsCatalog } from '@acorex/platform/layout/widget-core';
import { RootConfig } from './acorex-modules-organization-management.mjs';

async function factory(injector) {
    const entityDef = {
        module: RootConfig.module.name,
        name: RootConfig.entities.team.name,
        icon: RootConfig.entities.team.icon,
        title: RootConfig.entities.team.title,
        formats: {
            individual: '@organization-management:teams.entities.team.title',
            plural: '@organization-management:teams.entities.team.plural',
            searchResult: {
                title: '{{ title }}',
                description: RootConfig.module.title,
            },
        },
        relatedEntities: [
            {
                entity: `${RootConfig.module.name}.${RootConfig.entities.teamMember.name}`,
                title: '@organization-management:teams.related-entities.members.title',
                columns: ['employeeId', 'roleId'],
                conditions: [entityDetailsSimpleCondition('teamId')],
                actions: [...entityDetailsCrudActions('teamId')],
                layout: { type: 'tab-list' },
            },
        ],
        groups: [
            {
                id: 'basic-info',
                title: '@general:terms.interface.basic-info',
            },
        ],
        properties: [
            {
                name: 'id',
                title: 'ID',
                schema: {
                    dataType: 'uuid',
                    visible: false,
                    nullable: 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: AXPWidgetsCatalog.text,
                    },
                },
                validations: [
                    {
                        rule: 'required',
                    },
                ],
            },
            {
                name: 'description',
                title: `@general:terms.common.description`,
                groupId: 'basic-info',
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.largeText,
                    },
                },
            },
        ],
        columns: [
            { name: 'title' },
            { name: 'description' },
        ],
        interfaces: {
            master: {
                create: {
                    sections: [
                        {
                            id: 'basic-info',
                            layout: {
                                positions: {
                                    sm: { colSpan: 12 },
                                    md: { colSpan: 12 },
                                    lg: { colSpan: 12 },
                                },
                            },
                        },
                    ],
                    properties: [
                        {
                            name: 'title',
                            layout: {
                                positions: {
                                    sm: { colSpan: 12 },
                                    md: { colSpan: 12 },
                                    lg: { colSpan: 8 },
                                },
                                label: {
                                    visible: true,
                                },
                            },
                        },
                        {
                            name: 'description',
                            layout: {
                                positions: {
                                    sm: { colSpan: 12 },
                                    md: { colSpan: 12 },
                                    lg: { colSpan: 12 },
                                },
                                label: {
                                    visible: true,
                                },
                            },
                        },
                    ],
                },
                update: {
                    sections: [
                        {
                            id: 'basic-info',
                            layout: {
                                positions: {
                                    sm: { colSpan: 12 },
                                    md: { colSpan: 12 },
                                    lg: { colSpan: 12 },
                                },
                            },
                        },
                    ],
                    properties: [
                        {
                            name: 'title',
                            layout: {
                                positions: {
                                    sm: { colSpan: 12 },
                                    md: { colSpan: 12 },
                                    lg: { colSpan: 12 },
                                },
                                label: {
                                    visible: true,
                                },
                            },
                        },
                        {
                            name: 'description',
                            layout: {
                                positions: {
                                    sm: { colSpan: 12 },
                                    md: { colSpan: 12 },
                                    lg: { colSpan: 12 },
                                },
                                label: {
                                    visible: true,
                                },
                            },
                        },
                    ],
                },
                single: {
                    title: '{{title}}',
                    sections: [
                        {
                            id: 'basic-info',
                            layout: {
                                positions: {
                                    sm: { colSpan: 12 },
                                    md: { colSpan: 12 },
                                    lg: { colSpan: 12 },
                                },
                            },
                        },
                    ],
                    properties: [
                        {
                            name: 'title',
                            layout: {
                                positions: {
                                    sm: { colSpan: 12 },
                                    md: { colSpan: 8 },
                                    lg: { colSpan: 6 },
                                },
                                label: {
                                    visible: true,
                                },
                            },
                        },
                        {
                            name: 'description',
                            layout: {
                                positions: {
                                    sm: { colSpan: 12 },
                                    md: { colSpan: 12 },
                                    lg: { colSpan: 12 },
                                },
                                label: {
                                    visible: true,
                                },
                            },
                        },
                    ],
                    actions: [entityMasterDeleteAction()],
                },
                list: {
                    actions: [...entityMasterCrudActions()],
                    views: [createAllQueryView({ sorts: [{ name: 'title', dir: 'asc' }] })],
                },
            },
        },
    };
    return entityDef;
}

export { factory };
//# sourceMappingURL=acorex-modules-organization-management-team.entity-DX6D0gSo.mjs.map
