import * as i0 from '@angular/core';
import { Injectable, NgModule, inject, Injector } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AXP_PERMISSION_DEFINITION_PROVIDER } from '@acorex/platform/auth';
import { createAllQueryView, AXPEntityQueryType, AXPSearchCommandProvider, AXP_MENU_PROVIDER, AXP_SEARCH_PROVIDER, AXP_SETTING_DEFINITION_PROVIDER } from '@acorex/platform/common';
import { AXMEntityCrudServiceImpl, entityMasterCrudActions, entityMasterRecordActions, AXPEntityService, AXP_ENTITY_DEFINITION_LOADER } from '@acorex/platform/layout/entity';
import { AXP_DATASOURCE_DEFINITION_PROVIDER } from '@acorex/platform/core';
import { AXPWidgetsCatalog } from '@acorex/platform/layout/widget-core';
import { AXDataSource } from '@acorex/cdk/common';
import { AXTranslationService } from '@acorex/core/translation';

const config = {
    i18n: 'party-management',
};
const RootConfig = {
    config,
    module: {
        name: 'PartyManagement',
        title: '@party-management:module-name',
        icon: 'fa-light fa-users',
    },
    entities: {
        industry: {
            name: 'Industry',
            title: '@party-management:industry.individual-title',
            titlePlural: '@party-management:industry.plural-title',
            icon: 'fa-light fa-industry',
        },
        party: {
            name: 'Party',
            title: '@party-management:party.individual-title',
            fullname: 'PartyManagement.Party',
            titlePlural: '@party-management:party.plural-title',
            icon: 'fa-light fa-user',
        },
        partyRole: {
            name: 'PartyRole',
            title: '@party-management:party-role.individual-title',
            titlePlural: '@party-management:party-role.plural-title',
            icon: 'fa-light fa-user-tag',
        },
        partyRelationship: {
            name: 'PartyRelationship',
            title: '@party-management:party-relationship.individual-title',
            titlePlural: '@party-management:party-relationship.plural-title',
            icon: 'fa-light fa-link',
        },
        partyRelationshipType: {
            name: 'PartyRelationshipType',
            title: '@party-management:party-relationship-type.individual-title',
            titlePlural: '@party-management:party-relationship-type.plural-title',
            icon: 'fa-light fa-diagram-project',
        },
        partyIdentifierType: {
            name: 'PartyIdentifierType',
            title: '@party-management:party-identifier-type.individual-title',
            titlePlural: '@party-management:party-identifier-type.plural-title',
            icon: 'fa-light fa-id-card',
        },
        partyIdentifier: {
            name: 'PartyIdentifier',
            title: '@party-management:party-identifier.individual-title',
            titlePlural: '@party-management:party-identifier.plural-title',
            icon: 'fa-light fa-fingerprint',
        },
    },
};

class AXMIndustryService extends AXMEntityCrudServiceImpl {
}
class AXMIndustryServiceImpl extends AXMIndustryService {
    constructor() {
        super(`${RootConfig.module.name}.${RootConfig.entities.industry.name}`);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMIndustryServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMIndustryServiceImpl }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMIndustryServiceImpl, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class AXMPartyService extends AXMEntityCrudServiceImpl {
}
class AXMPartyServiceImpl extends AXMPartyService {
    constructor() {
        super(`${RootConfig.module.name}.${RootConfig.entities.party.name}`);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyServiceImpl }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyServiceImpl, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class AXMPartyRoleService extends AXMEntityCrudServiceImpl {
}
class AXMPartyRoleServiceImpl extends AXMPartyRoleService {
    constructor() {
        super(`${RootConfig.module.name}.${RootConfig.entities.partyRole.name}`);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRoleServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRoleServiceImpl }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRoleServiceImpl, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class AXMPartyRelationshipService extends AXMEntityCrudServiceImpl {
}
class AXMPartyRelationshipServiceImpl extends AXMPartyRelationshipService {
    constructor() {
        super(`${RootConfig.module.name}.${RootConfig.entities.partyRelationship.name}`);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipServiceImpl }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipServiceImpl, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class AXMPartyIdentifierTypeService extends AXMEntityCrudServiceImpl {
}
class AXMPartyIdentifierTypeServiceImpl extends AXMPartyIdentifierTypeService {
    constructor() {
        super(`${RootConfig.module.name}.${RootConfig.entities.partyIdentifierType.name}`);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierTypeServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierTypeServiceImpl }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierTypeServiceImpl, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class AXMPartyIdentifierService extends AXMEntityCrudServiceImpl {
}
class AXMPartyIdentifierServiceImpl extends AXMPartyIdentifierService {
    constructor() {
        super(`${RootConfig.module.name}.${RootConfig.entities.partyIdentifier.name}`);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierServiceImpl }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierServiceImpl, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

class AXMPartyRelationshipTypeService extends AXMEntityCrudServiceImpl {
}
class AXMPartyRelationshipTypeServiceImpl extends AXMPartyRelationshipTypeService {
    constructor() {
        super(`${RootConfig.module.name}.${RootConfig.entities.partyRelationshipType.name}`);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipTypeServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipTypeServiceImpl }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipTypeServiceImpl, decorators: [{
            type: Injectable
        }], ctorParameters: () => [] });

//#region ----   Imports   ----
//#endregion
async function partyRelationshipTypeFactory(injector) {
    const dataService = injector.get(AXMPartyRelationshipTypeService);
    const entityDef = {
        module: RootConfig.module.name,
        name: RootConfig.entities.partyRelationshipType.name,
        title: RootConfig.entities.partyRelationshipType.title,
        icon: RootConfig.entities.partyRelationshipType.icon,
        formats: {
            individual: RootConfig.entities.partyRelationshipType.title,
            plural: RootConfig.entities.partyRelationshipType.titlePlural,
            searchResult: {
                title: RootConfig.entities.partyRelationshipType.title,
                description: '@party-management:party-relationship-type.search-result-description',
            },
        },
        groups: [
            { id: 'basic-info', title: '@general:terms.interface.basic-info' },
            { id: 'settings', title: '@general:terms.interface.settings' },
        ],
        properties: [
            {
                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',
                options: { sort: { enabled: false }, filter: { advance: { enabled: true }, inline: { enabled: false } } },
                schema: {
                    dataType: 'string',
                    interface: {
                        type: AXPWidgetsCatalog.largeText,
                        options: { rows: 3 },
                    },
                },
            },
            {
                name: 'isDirectional',
                title: '@party-management:party-relationship-type.properties.is-directional.title',
                groupId: 'settings',
                options: { sort: { enabled: true }, filter: { advance: { enabled: true }, inline: { enabled: true } } },
                schema: {
                    dataType: 'boolean',
                    interface: {
                        type: AXPWidgetsCatalog.toggle,
                    },
                },
            },
        ],
        columns: [{ name: 'title' }, { name: 'isDirectional' }],
        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) => 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' }, { id: 'settings' }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
                        { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 2 } } } },
                        { name: 'isDirectional', layout: { positions: { lg: { colSpan: 3, order: 3 } } } },
                    ],
                },
                update: {
                    sections: [{ id: 'basic-info' }, { id: 'settings' }],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
                        { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
                        { name: 'isDirectional', layout: { positions: { lg: { colSpan: 3, order: 4 } } } },
                    ],
                },
                single: {
                    title: '{{title}}',
                    sections: [
                        { id: 'basic-info' },
                        { id: 'settings' },
                    ],
                    properties: [
                        { name: 'title', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
                        { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
                        { name: 'isDirectional', layout: { positions: { lg: { colSpan: 3, order: 4 } } } },
                    ],
                    actions: [...entityMasterRecordActions()],
                },
                list: {
                    actions: [...entityMasterCrudActions()],
                    views: [createAllQueryView({ sorts: [{ name: 'title', dir: 'asc' }] })],
                },
            },
        },
    };
    return entityDef;
}

var partyRelationshipType_entity = /*#__PURE__*/Object.freeze({
    __proto__: null,
    partyRelationshipTypeFactory: partyRelationshipTypeFactory
});

class AXMIndustryEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMIndustryEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXMIndustryEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMIndustryEntityModule, providers: [
            {
                provide: AXMIndustryService,
                useClass: AXMIndustryServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMIndustryEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [],
                    exports: [],
                    declarations: [],
                    providers: [
                        {
                            provide: AXMIndustryService,
                            useClass: AXMIndustryServiceImpl,
                        },
                    ],
                }]
        }] });

class AXMPartyEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyEntityModule, providers: [
            {
                provide: AXMPartyService,
                useClass: AXMPartyServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [],
                    exports: [],
                    declarations: [],
                    providers: [
                        {
                            provide: AXMPartyService,
                            useClass: AXMPartyServiceImpl,
                        },
                    ],
                }]
        }] });

class AXMPartyRoleEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRoleEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRoleEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRoleEntityModule, providers: [
            {
                provide: AXMPartyRoleService,
                useClass: AXMPartyRoleServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRoleEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [],
                    exports: [],
                    declarations: [],
                    providers: [
                        {
                            provide: AXMPartyRoleService,
                            useClass: AXMPartyRoleServiceImpl,
                        },
                    ],
                }]
        }] });

class AXMPartyRelationshipEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipEntityModule, providers: [
            {
                provide: AXMPartyRelationshipService,
                useClass: AXMPartyRelationshipServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [],
                    exports: [],
                    declarations: [],
                    providers: [
                        {
                            provide: AXMPartyRelationshipService,
                            useClass: AXMPartyRelationshipServiceImpl,
                        },
                    ],
                }]
        }] });

class AXMPartyIdentifierTypeEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierTypeEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierTypeEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierTypeEntityModule, providers: [
            {
                provide: AXMPartyIdentifierTypeService,
                useClass: AXMPartyIdentifierTypeServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierTypeEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [],
                    exports: [],
                    declarations: [],
                    providers: [
                        {
                            provide: AXMPartyIdentifierTypeService,
                            useClass: AXMPartyIdentifierTypeServiceImpl,
                        },
                    ],
                }]
        }] });

class AXMPartyIdentifierEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierEntityModule, providers: [
            {
                provide: AXMPartyIdentifierService,
                useClass: AXMPartyIdentifierServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyIdentifierEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [],
                    exports: [],
                    declarations: [],
                    providers: [
                        {
                            provide: AXMPartyIdentifierService,
                            useClass: AXMPartyIdentifierServiceImpl,
                        },
                    ],
                }]
        }] });

class AXMPartyRelationshipTypeEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipTypeEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipTypeEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipTypeEntityModule, providers: [
            {
                provide: AXMPartyRelationshipTypeService,
                useClass: AXMPartyRelationshipTypeServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyRelationshipTypeEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [],
                    exports: [],
                    declarations: [],
                    providers: [
                        {
                            provide: AXMPartyRelationshipTypeService,
                            useClass: AXMPartyRelationshipTypeServiceImpl,
                        },
                    ],
                }]
        }] });

// Entity Services

class AXMPartyManagementEntityProvider {
    constructor() {
        this.injector = inject(Injector);
    }
    preload() {
        const module = RootConfig.module.name;
        return Array.from(Object.values(RootConfig.entities)).map((entity) => ({
            module: module,
            entity: entity.name,
        }));
    }
    async get(moduleName, entityName) {
        if (moduleName == RootConfig.module.name) {
            switch (entityName) {
                case RootConfig.entities.industry.name:
                    return (await import('./acorex-modules-party-management-industry.entity-CCzDYJFD.mjs')).industryFactory(this.injector);
                case RootConfig.entities.party.name:
                    return (await import('./acorex-modules-party-management-party.entity-Dw-VX8US.mjs')).partyFactory(this.injector);
                case RootConfig.entities.partyRole.name:
                    return (await import('./acorex-modules-party-management-party-role.entity-BjV7pJZU.mjs')).partyRoleFactory(this.injector);
                case RootConfig.entities.partyRelationship.name:
                    return (await import('./acorex-modules-party-management-party-relationship.entity-DvgpmOkA.mjs')).partyRelationshipFactory(this.injector);
                case RootConfig.entities.partyRelationshipType?.name:
                    return (await Promise.resolve().then(function () { return partyRelationshipType_entity; })).partyRelationshipTypeFactory(this.injector);
                case RootConfig.entities.partyIdentifierType.name:
                    return (await import('./acorex-modules-party-management-party-identifier-type.entity-UMIM9R7g.mjs')).partyIdentifierTypeFactory(this.injector);
                case RootConfig.entities.partyIdentifier.name:
                    return (await import('./acorex-modules-party-management-party-identifier.entity-DWp9iYIa.mjs')).partyIdentifierFactory(this.injector);
            }
        }
        return null;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyManagementEntityProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyManagementEntityProvider }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyManagementEntityProvider, decorators: [{
            type: Injectable
        }] });

const AXPPartyManagementMenuKeys = {
    Parties: 'contact-management:menu:parties',
    PartyIdentifierTypes: 'contact-management:menu:party-identifier-types',
    PartyRelationshipTypes: 'contact-management:menu:party-relationship-types',
    Industries: 'contact-management:menu:industries',
};

class AXMMenuProvider {
    constructor() {
        this.entityService = inject(AXPEntityService);
    }
    async provide(context) {
        const module = RootConfig.module;
        context.find('contact-management:menu').addItems([
            {
                name: AXPPartyManagementMenuKeys.Parties,
                text: '@party-management:party.plural-title',
                path: this.entityService.createPath(module.name, RootConfig.entities.party.name),
                icon: RootConfig.entities.party.icon,
                priority: 1,
            },
            {
                name: 'contact-management:menu:divider-party-1',
                text: '',
                type: 'break',
                priority: 2,
            },
            {
                name: AXPPartyManagementMenuKeys.PartyIdentifierTypes,
                text: '@party-management:party-identifier-type.plural-title',
                path: this.entityService.createPath(module.name, RootConfig.entities.partyIdentifierType.name),
                icon: RootConfig.entities.partyIdentifierType.icon,
                priority: 3,
            },
            {
                name: AXPPartyManagementMenuKeys.PartyRelationshipTypes,
                text: '@party-management:party-relationship-type.plural-title',
                path: this.entityService.createPath(module.name, RootConfig.entities.partyRelationshipType.name),
                icon: RootConfig.entities.partyRelationshipType.icon,
                priority: 4,
            },
            {
                name: AXPPartyManagementMenuKeys.Industries,
                text: '@party-management:industry.plural-title',
                path: this.entityService.createPath(module.name, RootConfig.entities.industry.name),
                icon: RootConfig.entities.industry.icon,
                priority: 5,
            },
        ]);
        // context.addItems([
        //   {
        //     priority: 9001,
        //     text: '@party-management:root-menu',
        //     icon: module.icon,
        //     children: [
        //       {
        //         text: '@party-management:party.plural-title',
        //         path: this.entityService.createPath(module.name, RootConfig.entities.party.name),
        //         icon: RootConfig.entities.party.icon,
        //         priority: 1,
        //       },
        //       {
        //         text: '',
        //         type: 'break',
        //         priority: 2,
        //       },
        //       {
        //         text: '@party-management:party-identifier-type.plural-title',
        //         path: this.entityService.createPath(module.name, RootConfig.entities.partyIdentifierType.name),
        //         icon: RootConfig.entities.partyIdentifierType.icon,
        //         priority: 3,
        //       },
        //       {
        //         text: '@party-management:party-relationship-type.plural-title',
        //         path: this.entityService.createPath(module.name, RootConfig.entities.partyRelationshipType.name),
        //         icon: RootConfig.entities.partyRelationshipType.icon,
        //         priority: 4,
        //       },
        //       {
        //         text: '@party-management:industry.plural-title',
        //         path: this.entityService.createPath(module.name, RootConfig.entities.industry.name),
        //         icon: RootConfig.entities.industry.icon,
        //         priority: 5,
        //       },
        //     ],
        //   },
        // ]);
    }
}

class AXMSearchCommandProvider extends AXPSearchCommandProvider {
    constructor() {
        super(...arguments);
        this.commands = [
            {
                group: 'command',
                title: 'New Party',
                icon: RootConfig.entities.party.icon,
                description: 'Create a new party (individual or organization).',
                command: {
                    name: 'create-entity',
                    options: {
                        entity: `${RootConfig.module.name}.${RootConfig.entities.party.name}`,
                    },
                },
            },
            {
                group: 'command',
                title: 'New Party Role',
                icon: RootConfig.entities.partyRole.icon,
                description: 'Assign a role to a party.',
                command: {
                    name: 'create-entity',
                    options: {
                        entity: `${RootConfig.module.name}.${RootConfig.entities.partyRole.name}`,
                    },
                },
            },
            {
                group: 'command',
                title: 'New Party Relationship',
                icon: RootConfig.entities.partyRelationship.icon,
                description: 'Create a relationship between two parties.',
                command: {
                    name: 'create-entity',
                    options: {
                        entity: `${RootConfig.module.name}.${RootConfig.entities.partyRelationship.name}`,
                    },
                },
            },
            {
                group: 'command',
                title: 'New Party Relationship Type',
                icon: RootConfig.entities.partyRelationshipType.icon,
                description: 'Define a new type of party relationship.',
                command: {
                    name: 'create-entity',
                    options: {
                        entity: `${RootConfig.module.name}.${RootConfig.entities.partyRelationshipType.name}`,
                    },
                },
            },
            {
                group: 'command',
                title: 'New Party Identifier Type',
                icon: RootConfig.entities.partyIdentifierType.icon,
                description: 'Create a new type of party identifier.',
                command: {
                    name: 'create-entity',
                    options: {
                        entity: `${RootConfig.module.name}.${RootConfig.entities.partyIdentifierType.name}`,
                    },
                },
            },
            {
                group: 'command',
                title: 'New Party Identifier',
                icon: RootConfig.entities.partyIdentifier.icon,
                description: 'Add an identifier to a party.',
                command: {
                    name: 'create-entity',
                    options: {
                        entity: `${RootConfig.module.name}.${RootConfig.entities.partyIdentifier.name}`,
                    },
                },
            },
        ];
    }
}

class AXMPartyRoleTypesDataSourceDefinition {
    constructor() {
        this.translate = inject(AXTranslationService);
    }
    async items() {
        const list = [
            { id: 'customer', title: await this.translate.translateAsync('@party-management:party-role.properties.role.options.customer') },
            { id: 'vendor', title: await this.translate.translateAsync('@party-management:party-role.properties.role.options.vendor') },
            { id: 'subcontractor', title: await this.translate.translateAsync('@party-management:party-role.properties.role.options.subcontractor') },
            { id: 'client', title: await this.translate.translateAsync('@party-management:party-role.properties.role.options.client') },
            { id: 'employee', title: await this.translate.translateAsync('@party-management:party-role.properties.role.options.employee') },
            { id: 'partner', title: await this.translate.translateAsync('@party-management:party-role.properties.role.options.partner') },
            { id: 'supplier', title: await this.translate.translateAsync('@party-management:party-role.properties.role.options.supplier') },
            { id: 'other', title: await this.translate.translateAsync('@party-management:party-role.properties.role.options.other') },
        ];
        return Promise.resolve([
            {
                name: 'party-role-types',
                title: 'Party Role Types',
                source: () => {
                    return new AXDataSource({
                        key: 'id',
                        load: async (_) => {
                            return {
                                items: list,
                                total: list.length,
                            };
                        },
                        byKey: async (key) => {
                            return list.find((item) => item.id === key);
                        },
                        pageSize: 20,
                    });
                },
                columns: [
                    {
                        name: 'id',
                        title: 'ID',
                        datatype: 'uuid',
                        type: AXPWidgetsCatalog.text,
                    },
                    {
                        name: 'title',
                        title: `Title`,
                        datatype: 'string',
                        type: AXPWidgetsCatalog.text,
                    },
                ],
                filters: [
                    {
                        field: 'title',
                        title: 'Title',
                        operator: {
                            type: 'equal',
                        },
                        widget: {
                            type: AXPWidgetsCatalog.text,
                        },
                        filterType: {
                            advance: true,
                            inline: true,
                        },
                    },
                ],
                textField: {
                    name: 'title',
                    title: 'Title',
                },
                valueField: {
                    name: 'id',
                    title: 'ID',
                },
            },
        ]);
    }
}

class AXMPartyManagementModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyManagementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyManagementModule, imports: [CommonModule,
            // Entity Modules
            AXMIndustryEntityModule,
            AXMPartyEntityModule,
            AXMPartyRoleEntityModule,
            AXMPartyRelationshipEntityModule,
            AXMPartyIdentifierTypeEntityModule,
            AXMPartyIdentifierEntityModule,
            AXMPartyRelationshipTypeEntityModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyManagementModule, providers: [
            // Entity Provider
            {
                provide: AXP_ENTITY_DEFINITION_LOADER,
                useClass: AXMPartyManagementEntityProvider,
                multi: true,
            },
            // Menu Provider
            {
                provide: AXP_MENU_PROVIDER,
                useClass: AXMMenuProvider,
                multi: true,
            },
            // Search Command Provider
            {
                provide: AXP_SEARCH_PROVIDER,
                useClass: AXMSearchCommandProvider,
                multi: true,
            },
            // Permission Provider
            {
                provide: AXP_PERMISSION_DEFINITION_PROVIDER,
                useFactory: async () => {
                    const injector = inject(Injector);
                    const provider = (await import('./acorex-modules-party-management-permission-definition.provider-Devwx69n.mjs')).AXMPermissionDefinitionProvider;
                    return new provider(injector);
                },
                multi: true,
            },
            // Settings Provider
            {
                provide: AXP_SETTING_DEFINITION_PROVIDER,
                useFactory: async () => {
                    const injector = inject(Injector);
                    const provider = (await Promise.resolve().then(function () { return setting_provider; })).AXMSettingProvider;
                    return new provider(injector);
                },
                multi: true,
            },
            // Data Source Provider
            {
                provide: AXP_DATASOURCE_DEFINITION_PROVIDER,
                useClass: AXMPartyRoleTypesDataSourceDefinition,
                multi: true,
            },
        ], imports: [CommonModule,
            // Entity Modules
            AXMIndustryEntityModule,
            AXMPartyEntityModule,
            AXMPartyRoleEntityModule,
            AXMPartyRelationshipEntityModule,
            AXMPartyIdentifierTypeEntityModule,
            AXMPartyIdentifierEntityModule,
            AXMPartyRelationshipTypeEntityModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXMPartyManagementModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        CommonModule,
                        // Entity Modules
                        AXMIndustryEntityModule,
                        AXMPartyEntityModule,
                        AXMPartyRoleEntityModule,
                        AXMPartyRelationshipEntityModule,
                        AXMPartyIdentifierTypeEntityModule,
                        AXMPartyIdentifierEntityModule,
                        AXMPartyRelationshipTypeEntityModule,
                    ],
                    providers: [
                        // Entity Provider
                        {
                            provide: AXP_ENTITY_DEFINITION_LOADER,
                            useClass: AXMPartyManagementEntityProvider,
                            multi: true,
                        },
                        // Menu Provider
                        {
                            provide: AXP_MENU_PROVIDER,
                            useClass: AXMMenuProvider,
                            multi: true,
                        },
                        // Search Command Provider
                        {
                            provide: AXP_SEARCH_PROVIDER,
                            useClass: AXMSearchCommandProvider,
                            multi: true,
                        },
                        // Permission Provider
                        {
                            provide: AXP_PERMISSION_DEFINITION_PROVIDER,
                            useFactory: async () => {
                                const injector = inject(Injector);
                                const provider = (await import('./acorex-modules-party-management-permission-definition.provider-Devwx69n.mjs')).AXMPermissionDefinitionProvider;
                                return new provider(injector);
                            },
                            multi: true,
                        },
                        // Settings Provider
                        {
                            provide: AXP_SETTING_DEFINITION_PROVIDER,
                            useFactory: async () => {
                                const injector = inject(Injector);
                                const provider = (await Promise.resolve().then(function () { return setting_provider; })).AXMSettingProvider;
                                return new provider(injector);
                            },
                            multi: true,
                        },
                        // Data Source Provider
                        {
                            provide: AXP_DATASOURCE_DEFINITION_PROVIDER,
                            useClass: AXMPartyRoleTypesDataSourceDefinition,
                            multi: true,
                        },
                    ],
                }]
        }] });

class AXMSettingProvider {
    constructor(injector) {
        this.injector = injector;
        this.translateService = this.injector.get(AXTranslationService);
    }
    async provide(context) {
    }
}

var setting_provider = /*#__PURE__*/Object.freeze({
    __proto__: null,
    AXMSettingProvider: AXMSettingProvider
});

//export * from './lib/pages';

/**
 * Generated bundle index. Do not edit.
 */

export { AXMIndustryService as A, RootConfig as R, AXMPartyService as a, AXMPartyRoleService as b, AXMPartyRelationshipService as c, AXMPartyIdentifierTypeService as d, AXMPartyIdentifierService as e, AXMPartyManagementModule as f, AXMPartyManagementEntityProvider as g, AXMMenuProvider as h, AXMSearchCommandProvider as i, AXMSettingProvider as j };
//# sourceMappingURL=acorex-modules-party-management-acorex-modules-party-management-BkRsPvsw.mjs.map
