import { createAllQueryView, AXPEntityCommandScope } from '@acorex/platform/common';
import { entityMasterCrudActions, entityMasterRecordActions } from '@acorex/platform/layout/entity';
import { AXPWidgetsCatalog } from '@acorex/platform/layout/widget-core';
import { RootConfig } from './acorex-modules-meeting-management.mjs';

async function meetingScheduleFactory(injector) {
    const entityDef = {
        module: RootConfig.module.name,
        name: RootConfig.entities.meetingSchedule.name,
        title: RootConfig.entities.meetingSchedule.title,
        icon: RootConfig.entities.meetingSchedule.icon,
        formats: {
            individual: RootConfig.entities.meetingSchedule.title,
            plural: RootConfig.entities.meetingSchedule.titlePlural,
            searchResult: {
                title: '{{ meetingId.title }}',
                description: RootConfig.module.title,
            },
        },
        relatedEntities: [],
        groups: [{ id: 'section', title: RootConfig.entities.meetingSchedule.title }],
        properties: [
            {
                name: 'meetingId',
                title: '@meeting-management:meeting-schedule.meetingId',
                groupId: 'section',
                schema: {
                    dataType: 'object',
                    interface: {
                        type: AXPWidgetsCatalog.lookup,
                        options: {
                            look: 'select',
                            entity: `${RootConfig.module.name}.${RootConfig.entities.meeting.name}`,
                            expose: [
                                { source: 'id', target: 'meeting.id' },
                                { source: 'title', target: 'meeting.title' },
                            ],
                        },
                    },
                },
                validations: [{ rule: 'required' }],
            },
            {
                name: 'scheduleRule',
                title: '@meeting-management:meeting-schedule.scheduleRule',
                groupId: 'section',
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.largeText,
                        options: { rows: 3 },
                    },
                },
                validations: [{ rule: 'required' }],
            },
        ],
        columns: [{ name: 'meetingId' }, { name: 'scheduleRule' }],
        interfaces: {
            master: {
                create: {
                    sections: [{ id: 'section' }],
                    properties: [
                        { name: 'meetingId', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
                        { name: 'scheduleRule', layout: { positions: { lg: { colSpan: 12, order: 2 } } } },
                    ],
                },
                update: {
                    sections: [{ id: 'section' }],
                    properties: [
                        { name: 'meetingId', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
                        { name: 'scheduleRule', layout: { positions: { lg: { colSpan: 12, order: 2 } } } },
                    ],
                },
                single: {
                    title: '{{meeting.title}}',
                    sections: [{ id: 'section' }],
                    properties: [
                        { name: 'meetingId', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
                        { name: 'scheduleRule', layout: { positions: { lg: { colSpan: 12, order: 2 } } } },
                    ],
                    actions: [...entityMasterRecordActions()],
                },
                list: {
                    actions: [
                        ...entityMasterCrudActions(),
                        {
                            title: '@general:actions.edit.title',
                            command: 'quick-modify-entity',
                            priority: 'secondary',
                            type: 'update',
                            scope: AXPEntityCommandScope.Individual,
                        },
                    ],
                    views: [
                        createAllQueryView({
                            sorts: [{ name: 'meetingId', dir: 'asc' }],
                        }),
                    ],
                },
            },
        },
    };
    return entityDef;
}

export { meetingScheduleFactory };
//# sourceMappingURL=acorex-modules-meeting-management-meeting-schedule.entity-CrM29ykP.mjs.map
