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

async function emergencyContactFactory(injector) {
    const dataService = injector.get(AXMEmergencyContactService);
    const entityDef = {
        module: RootConfig.module.name,
        name: RootConfig.entities.emergencyContact.name,
        title: RootConfig.entities.emergencyContact.title,
        icon: RootConfig.entities.emergencyContact.icon,
        formats: {
            individual: RootConfig.entities.emergencyContact.title,
            plural: RootConfig.entities.emergencyContact.titlePlural,
            searchResult: {
                title: '{{ name }} - {{ phoneNumber }}',
                description: RootConfig.module.title,
            },
        },
        plugins: [
            { name: 'history' },
            { name: 'lock' },
            { name: 'compare' },
            { name: 'category', options: { enableAppearance: true, enableMetaDataSelector: true } },
            { name: 'meta-data-form', options: { path: 'categoryIds' } },
        ],
        groups: [
            {
                id: 'basic-info',
                title: '@general:terms.interface.basic-info',
            },
            {
                id: 'contact-info',
                title: '@contact-management:emergency-contact.contact-info',
            },
            {
                id: 'location',
                title: '@contact-management:emergency-contact.location-info',
            },
            {
                id: 'settings',
                title: '@general:terms.interface.settings',
            },
        ],
        properties: [
            {
                name: 'name',
                title: '@general:terms.common.name',
                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: 'shortName',
                title: '@general:terms.common.short-name',
                groupId: 'basic-info',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.text,
                        options: {
                            placeholder: 'e.g., 911, Police, Fire',
                        },
                    },
                },
            },
            {
                name: 'description',
                title: '@general:terms.common.description',
                groupId: 'basic-info',
                options: {
                    sort: {
                        enabled: false,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: false,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.largeText,
                        options: {
                            rows: 3,
                        },
                    },
                },
            },
            {
                name: 'phoneNumber',
                title: '@contact-management:emergency-contact.phone-number',
                groupId: 'contact-info',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.contact,
                        options: {
                            placeholder: 'e.g., 911, +1-800-273-8255',
                            type: 'phone',
                            hasLabel: false
                        },
                    },
                },
                validations: [
                    {
                        rule: 'required',
                    },
                ],
            },
            {
                name: 'alternateNumbers',
                title: '@contact-management:emergency-contact.alternate-numbers',
                groupId: 'contact-info',
                options: {
                    sort: {
                        enabled: false,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: false,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.text,
                        options: {
                            placeholder: 'e.g., 911, +1-800-273-8255',
                        },
                    },
                },
            },
            {
                name: 'textNumber',
                title: '@contact-management:emergency-contact.text-number',
                groupId: 'contact-info',
                options: {
                    sort: {
                        enabled: false,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: false,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.contact,
                        options: {
                            placeholder: 'SMS number if available',
                            hasLabel: false,
                            type: 'phone',
                        },
                    },
                },
            },
            {
                name: 'website',
                title: '@contact-management:emergency-contact.website',
                groupId: 'contact-info',
                options: {
                    sort: {
                        enabled: false,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: false,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.text,
                        options: {
                            placeholder: 'https://www.example.gov',
                        },
                    },
                },
            },
            {
                name: 'email',
                title: '@contact-management:emergency-contact.email',
                groupId: 'contact-info',
                options: {
                    sort: {
                        enabled: false,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: false,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.text,
                        options: {
                            placeholder: 'contact@emergency.gov',
                        },
                    },
                },
            },
            {
                name: 'country',
                title: '@general:terms.geography.country',
                groupId: 'location',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.text,
                    },
                },
            },
            {
                name: 'region',
                title: '@general:terms.geography.region',
                groupId: 'location',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.text,
                    },
                },
            },
            {
                name: 'city',
                title: '@general:terms.geography.city',
                groupId: 'location',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.text,
                    },
                },
            },
            {
                name: 'isNational',
                title: '@contact-management:emergency-contact.is-national',
                groupId: 'location',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'boolean',
                    interface: {
                        type: AXPWidgetsCatalog.toggle,
                    },
                },
            },
            {
                name: 'isRegional',
                title: '@contact-management:emergency-contact.is-regional',
                groupId: 'location',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'boolean',
                    interface: {
                        type: AXPWidgetsCatalog.toggle,
                    },
                },
            },
            {
                name: 'isLocal',
                title: '@contact-management:emergency-contact.is-local',
                groupId: 'location',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'boolean',
                    interface: {
                        type: AXPWidgetsCatalog.toggle,
                    },
                },
            },
            {
                name: 'availability',
                title: '@general:terms.organizations.availability',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    defaultValue: '24/7',
                    interface: {
                        type: AXPWidgetsCatalog.select,
                        options: {
                            valueField: 'value',
                            textField: 'text',
                            dataSource: [
                                { value: '24/7', text: '24/7' },
                                { value: 'business_hours', text: 'Business Hours' },
                                { value: 'weekends_only', text: 'Weekends Only' },
                                { value: 'nights_only', text: 'Nights Only' },
                            ],
                        },
                    },
                },
                validations: [
                    {
                        rule: 'required',
                    },
                ],
            },
            {
                name: 'languages',
                title: '@contact-management:emergency-contact.languages',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: false,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: false,
                        },
                    },
                },
                schema: {
                    dataType: 'object',
                    interface: {
                        type: AXPWidgetsCatalog.select,
                        options: {
                            dataSource: "languages",
                            valueField: "code",
                            textField: "title",
                            multiple: true,
                        },
                    },
                },
            },
            {
                name: 'isTextCapable',
                title: '@contact-management:emergency-contact.is-text-capable',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'boolean',
                    interface: {
                        type: AXPWidgetsCatalog.toggle,
                    },
                },
            },
            {
                name: 'isVideoCallCapable',
                title: '@contact-management:emergency-contact.is-video-call-capable',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'boolean',
                    interface: {
                        type: AXPWidgetsCatalog.toggle,
                    },
                },
            },
            {
                name: 'whenToCall',
                title: '@contact-management:emergency-contact.when-to-call',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: false,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: false,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.largeText,
                        options: {
                            rows: 2,
                            placeholder: 'When to call this emergency number',
                        },
                    },
                },
            },
            {
                name: 'whenNotToCall',
                title: '@contact-management:emergency-contact.when-not-to-call',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: false,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: false,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.largeText,
                        options: {
                            rows: 2,
                            placeholder: 'When NOT to call this number',
                        },
                    },
                },
            },
            {
                name: 'instructions',
                title: '@contact-management:emergency-contact.instructions',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: false,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: false,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.largeText,
                        options: {
                            rows: 3,
                            placeholder: 'Special instructions for calling',
                        },
                    },
                },
            },
            {
                name: 'isActive',
                title: '@general:terms.status.states.is-active',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'boolean',
                    interface: {
                        type: AXPWidgetsCatalog.toggle,
                    },
                },
            },
            {
                name: 'isVerified',
                title: '@general:terms.status.states.is-verified',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'boolean',
                    interface: {
                        type: AXPWidgetsCatalog.toggle,
                    },
                },
            },
            {
                name: 'lastVerified',
                title: '@general:terms.datetime.last-verified',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: false,
                        },
                    },
                },
                schema: {
                    dataType: 'date',
                    interface: {
                        type: AXPWidgetsCatalog.dateTime,
                    },
                },
            },
            {
                name: 'showOnDashboard',
                title: '@contact-management:emergency-contact.show-on-dashboard',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'boolean',
                    interface: {
                        type: AXPWidgetsCatalog.toggle,
                    },
                },
            },
            {
                name: 'requiresConfirmation',
                title: '@contact-management:emergency-contact.requires-confirmation',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'boolean',
                    interface: {
                        type: AXPWidgetsCatalog.toggle,
                    },
                },
            },
            {
                name: 'isQuickDial',
                title: '@contact-management:emergency-contact.is-quick-dial',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: true,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: true,
                        },
                    },
                },
                schema: {
                    dataType: 'boolean',
                    interface: {
                        type: AXPWidgetsCatalog.toggle,
                    },
                },
            },
            {
                name: 'additionalInfo',
                title: '@general:terms.interface.additional-info',
                groupId: 'settings',
                options: {
                    sort: {
                        enabled: false,
                    },
                    filter: {
                        advance: {
                            enabled: true,
                        },
                        inline: {
                            enabled: false,
                        },
                    },
                },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.largeText,
                        options: {
                            rows: 3,
                            placeholder: 'Additional information',
                        },
                    },
                },
            },
        ],
        columns: [
            { name: 'name' },
            { name: 'shortName' },
            { name: 'phoneNumber' },
            { name: 'country' },
            { name: 'availability' },
            { name: 'isActive' },
            { name: 'isVerified' }
        ],
        commands: {
            create: {
                execute: async (data) => {
                    const res = await dataService.insertOne(data);
                    return { id: res };
                },
            },
            delete: {
                execute: async (id) => {
                    return await dataService.deleteOne(id);
                },
            },
            update: {
                execute: async (data) => {
                    return await dataService.updateOne(data.id, data);
                },
            },
        },
        queries: {
            byKey: {
                execute: async (id) => {
                    return await dataService.getOne(id);
                },
                type: AXPEntityQueryType.Single,
            },
            list: {
                execute: async (e) => {
                    return await dataService.query(e);
                },
                type: AXPEntityQueryType.List,
            },
        },
        interfaces: {
            master: {
                create: {
                    sections: [
                        { id: 'basic-info' },
                        { id: 'contact-info' },
                        { id: 'location' },
                        { id: 'settings' },
                    ],
                    properties: [
                        // Basic
                        { name: 'name', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
                        { name: 'shortName', layout: { positions: { lg: { colSpan: 6, order: 2 } } } },
                        { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
                        // Contact Info
                        { name: 'phoneNumber', layout: { positions: { lg: { colSpan: 6, order: 5 } } } },
                        { name: 'alternateNumbers', layout: { positions: { lg: { colSpan: 6, order: 6 } } } },
                        { name: 'textNumber', layout: { positions: { lg: { colSpan: 4, order: 7 } } } },
                        { name: 'website', layout: { positions: { lg: { colSpan: 4, order: 8 } } } },
                        { name: 'email', layout: { positions: { lg: { colSpan: 4, order: 9 } } } },
                        // Location
                        { name: 'country', layout: { positions: { lg: { colSpan: 4, order: 10 } } } },
                        { name: 'region', layout: { positions: { lg: { colSpan: 4, order: 11 } } } },
                        { name: 'city', layout: { positions: { lg: { colSpan: 4, order: 12 } } } },
                        { name: 'isNational', layout: { positions: { lg: { colSpan: 4, order: 13 } } } },
                        { name: 'isRegional', layout: { positions: { lg: { colSpan: 4, order: 14 } } } },
                        { name: 'isLocal', layout: { positions: { lg: { colSpan: 4, order: 15 } } } },
                        // Settings
                        { name: 'availability', layout: { positions: { lg: { colSpan: 6, order: 16 } } } },
                        { name: 'languages', layout: { positions: { lg: { colSpan: 6, order: 17 } } } },
                        { name: 'isTextCapable', layout: { positions: { lg: { colSpan: 3, order: 18 } } } },
                        { name: 'isVideoCallCapable', layout: { positions: { lg: { colSpan: 3, order: 19 } } } },
                        { name: 'priority', layout: { positions: { lg: { colSpan: 3, order: 20 } } } },
                        { name: 'isActive', layout: { positions: { lg: { colSpan: 3, order: 21 } } } },
                        { name: 'whenToCall', layout: { positions: { lg: { colStart: 1, colSpan: 6, order: 22 } } } },
                        { name: 'whenNotToCall', layout: { positions: { lg: { colSpan: 6, order: 23 } } } },
                        { name: 'instructions', layout: { positions: { lg: { colSpan: 12, order: 24 } } } },
                        { name: 'isVerified', layout: { positions: { lg: { colSpan: 3, order: 25 } } } },
                        { name: 'lastVerified', layout: { positions: { lg: { colSpan: 3, order: 26 } } } },
                        { name: 'showOnDashboard', layout: { positions: { lg: { colSpan: 3, order: 27 } } } },
                        { name: 'requiresConfirmation', layout: { positions: { lg: { colSpan: 3, order: 28 } } } },
                        { name: 'isQuickDial', layout: { positions: { lg: { colSpan: 6, order: 29 } } } },
                        { name: 'additionalInfo', layout: { positions: { lg: { colSpan: 12, order: 30 } } } },
                    ],
                },
                update: {
                    sections: [
                        { id: 'basic-info' },
                        { id: 'contact-info' },
                        { id: 'location' },
                        { id: 'settings' },
                    ],
                    properties: [
                        // Basic
                        { name: 'name', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
                        { name: 'shortName', layout: { positions: { lg: { colSpan: 6, order: 2 } } } },
                        { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
                        // Contact Info
                        { name: 'phoneNumber', layout: { positions: { lg: { colSpan: 6, order: 5 } } } },
                        { name: 'alternateNumbers', layout: { positions: { lg: { colSpan: 6, order: 6 } } } },
                        { name: 'textNumber', layout: { positions: { lg: { colSpan: 4, order: 7 } } } },
                        { name: 'website', layout: { positions: { lg: { colSpan: 4, order: 8 } } } },
                        { name: 'email', layout: { positions: { lg: { colSpan: 4, order: 9 } } } },
                        // Location
                        { name: 'country', layout: { positions: { lg: { colSpan: 4, order: 10 } } } },
                        { name: 'region', layout: { positions: { lg: { colSpan: 4, order: 11 } } } },
                        { name: 'city', layout: { positions: { lg: { colSpan: 4, order: 12 } } } },
                        { name: 'isNational', layout: { positions: { lg: { colSpan: 4, order: 13 } } } },
                        { name: 'isRegional', layout: { positions: { lg: { colSpan: 4, order: 14 } } } },
                        { name: 'isLocal', layout: { positions: { lg: { colSpan: 4, order: 15 } } } },
                        // Settings
                        { name: 'availability', layout: { positions: { lg: { colSpan: 6, order: 16 } } } },
                        { name: 'languages', layout: { positions: { lg: { colSpan: 6, order: 17 } } } },
                        { name: 'isTextCapable', layout: { positions: { lg: { colSpan: 3, order: 18 } } } },
                        { name: 'isVideoCallCapable', layout: { positions: { lg: { colSpan: 3, order: 19 } } } },
                        { name: 'priority', layout: { positions: { lg: { colSpan: 3, order: 20 } } } },
                        { name: 'isActive', layout: { positions: { lg: { colSpan: 3, order: 21 } } } },
                        { name: 'whenToCall', layout: { positions: { lg: { colStart: 1, colSpan: 6, order: 22 } } } },
                        { name: 'whenNotToCall', layout: { positions: { lg: { colSpan: 6, order: 23 } } } },
                        { name: 'instructions', layout: { positions: { lg: { colSpan: 12, order: 24 } } } },
                        { name: 'isVerified', layout: { positions: { lg: { colSpan: 3, order: 25 } } } },
                        { name: 'lastVerified', layout: { positions: { lg: { colSpan: 3, order: 26 } } } },
                        { name: 'showOnDashboard', layout: { positions: { lg: { colSpan: 3, order: 27 } } } },
                        { name: 'requiresConfirmation', layout: { positions: { lg: { colSpan: 3, order: 28 } } } },
                        { name: 'isQuickDial', layout: { positions: { lg: { colSpan: 6, order: 29 } } } },
                        { name: 'additionalInfo', layout: { positions: { lg: { colSpan: 12, order: 30 } } } },
                    ],
                },
                single: {
                    title: '{{name}}',
                    sections: [
                        { id: 'basic-info' },
                        { id: 'contact-info' },
                        { id: 'location' },
                        { id: 'settings' },
                    ],
                    properties: [
                        // Basic
                        { name: 'name', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
                        { name: 'shortName', layout: { positions: { lg: { colSpan: 6, order: 2 } } } },
                        { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
                        // Contact Info
                        { name: 'phoneNumber', layout: { positions: { lg: { colSpan: 6, order: 5 } } } },
                        { name: 'alternateNumbers', layout: { positions: { lg: { colSpan: 6, order: 6 } } } },
                        { name: 'textNumber', layout: { positions: { lg: { colSpan: 4, order: 7 } } } },
                        { name: 'website', layout: { positions: { lg: { colSpan: 4, order: 8 } } } },
                        { name: 'email', layout: { positions: { lg: { colSpan: 4, order: 9 } } } },
                        // Location
                        { name: 'country', layout: { positions: { lg: { colSpan: 4, order: 10 } } } },
                        { name: 'region', layout: { positions: { lg: { colSpan: 4, order: 11 } } } },
                        { name: 'city', layout: { positions: { lg: { colSpan: 4, order: 12 } } } },
                        { name: 'isNational', layout: { positions: { lg: { colSpan: 4, order: 13 } } } },
                        { name: 'isRegional', layout: { positions: { lg: { colSpan: 4, order: 14 } } } },
                        { name: 'isLocal', layout: { positions: { lg: { colSpan: 4, order: 15 } } } },
                        // Settings
                        { name: 'availability', layout: { positions: { lg: { colSpan: 6, order: 16 } } } },
                        { name: 'languages', layout: { positions: { lg: { colSpan: 6, order: 17 } } } },
                        { name: 'isTextCapable', layout: { positions: { lg: { colSpan: 3, order: 18 } } } },
                        { name: 'isVideoCallCapable', layout: { positions: { lg: { colSpan: 3, order: 19 } } } },
                        { name: 'priority', layout: { positions: { lg: { colSpan: 3, order: 20 } } } },
                        { name: 'isActive', layout: { positions: { lg: { colSpan: 3, order: 21 } } } },
                        { name: 'whenToCall', layout: { positions: { lg: { colStart: 1, colSpan: 6, order: 22 } } } },
                        { name: 'whenNotToCall', layout: { positions: { lg: { colSpan: 6, order: 23 } } } },
                        { name: 'instructions', layout: { positions: { lg: { colSpan: 12, order: 24 } } } },
                        { name: 'isVerified', layout: { positions: { lg: { colSpan: 3, order: 25 } } } },
                        { name: 'lastVerified', layout: { positions: { lg: { colSpan: 3, order: 26 } } } },
                        { name: 'showOnDashboard', layout: { positions: { lg: { colSpan: 3, order: 27 } } } },
                        { name: 'requiresConfirmation', layout: { positions: { lg: { colSpan: 3, order: 28 } } } },
                        { name: 'isQuickDial', layout: { positions: { lg: { colSpan: 6, order: 29 } } } },
                        { name: 'additionalInfo', layout: { positions: { lg: { colSpan: 12, order: 30 } } } },
                    ],
                    actions: [
                        ...entityMasterRecordActions()
                    ],
                },
                list: {
                    actions: [
                        ...entityMasterCrudActions(),
                    ],
                    views: [
                        createAllQueryView({
                            sorts: [{ name: 'name', dir: 'asc' }]
                        }),
                    ],
                },
            },
        },
    };
    return entityDef;
}

export { emergencyContactFactory };
//# sourceMappingURL=acorex-modules-contact-management-emergency-contact.entity-ZaJm8D5Q.mjs.map
