import * as i0 from '@angular/core';
import { Injectable, NgModule, inject, Injector } from '@angular/core';
import { AXP_MODULE_MANIFEST_PROVIDER } from '@acorex/platform/core';
import { AXMEntityCrudServiceImpl, AXPEntityService, AXP_ENTITY_DEFINITION_LOADER } from '@acorex/platform/layout/entity';
import { AXP_MENU_PROVIDER } from '@acorex/platform/common';
import { AXP_PERMISSION_DEFINITION_PROVIDER } from '@acorex/platform/auth';
import { AXP_IDENTIFIER_RULES } from '@acorex/modules/identifier-management';
import { AXTranslationService } from '@acorex/core/translation';
import { AXPCommonMenuKeys } from '@acorex/modules/common';

const config = {
    i18n: 'customer-management',
    module: 'CustomerManagement',
};
const RootConfig = {
    config,
    module: {
        route: 'customer-management',
        name: config.module,
        title: `@${config.i18n}:module.title`,
        icon: 'fa-light fa-handshake',
    },
    entities: {
        customer: {
            name: 'Customer',
            source: `${config.module}.Customer`,
            title: `@${config.i18n}:customers.entities.customer.title`,
            titlePlural: `@${config.i18n}:customers.entities.customer.plural`,
            icon: 'fa-light fa-building-user',
        },
        lead: {
            name: 'Lead',
            source: `${config.module}.Lead`,
            title: `@${config.i18n}:leads.entities.lead.title`,
            titlePlural: `@${config.i18n}:leads.entities.lead.plural`,
            icon: 'fa-light fa-user-plus',
        },
        opportunity: {
            name: 'Opportunity',
            source: `${config.module}.Opportunity`,
            title: `@${config.i18n}:opportunities.entities.opportunity.title`,
            titlePlural: `@${config.i18n}:opportunities.entities.opportunity.plural`,
            icon: 'fa-light fa-briefcase',
        },
        opportunityStage: {
            name: 'OpportunityStage',
            source: `${config.module}.OpportunityStage`,
            title: `@${config.i18n}:opportunities.entities.opportunity-stage.title`,
            titlePlural: `@${config.i18n}:opportunities.entities.opportunity-stage.plural`,
            icon: 'fa-light fa-stairs',
        },
        salesPipeline: {
            name: 'SalesPipeline',
            source: `${config.module}.SalesPipeline`,
            title: `@${config.i18n}:opportunities.entities.sales-pipeline.title`,
            titlePlural: `@${config.i18n}:opportunities.entities.sales-pipeline.plural`,
            icon: 'fa-light fa-diagram-project',
        },
        activity: {
            name: 'Activity',
            source: `${config.module}.Activity`,
            title: `@${config.i18n}:activities.entities.activity.title`,
            titlePlural: `@${config.i18n}:activities.entities.activity.plural`,
            icon: 'fa-light fa-calendar-check',
        },
        dealContactRole: {
            name: 'DealContactRole',
            source: `${config.module}.DealContactRole`,
            title: `@${config.i18n}:opportunities.entities.deal-contact-role.title`,
            titlePlural: `@${config.i18n}:opportunities.entities.deal-contact-role.plural`,
            icon: 'fa-light fa-users',
        },
    },
};

//#region ----   Imports   ----
//#endregion
//#region ----   Manifest Definition   ----
/**
 * Customer Management Module Manifest.
 * Defines module metadata, features, and provider references.
 */
const CustomerManagementManifest = {
    name: RootConfig.module.name,
    version: '1.0.0',
    title: RootConfig.module.title,
    icon: RootConfig.module.icon,
    i18n: RootConfig.config.i18n,
    // Module dependencies (optional)
};
//#endregion

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

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

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

class AXMCustomerManagementLeadEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementLeadEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementLeadEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementLeadEntityModule, providers: [
            {
                provide: AXMCustomerManagementLeadEntityService,
                useClass: AXMCustomerManagementLeadEntityServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementLeadEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    providers: [
                        {
                            provide: AXMCustomerManagementLeadEntityService,
                            useClass: AXMCustomerManagementLeadEntityServiceImpl,
                        },
                    ],
                }]
        }] });

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

class AXMCustomerManagementOpportunityStageEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementOpportunityStageEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementOpportunityStageEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementOpportunityStageEntityModule, providers: [
            {
                provide: AXMCustomerManagementOpportunityStageEntityService,
                useClass: AXMCustomerManagementOpportunityStageEntityServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementOpportunityStageEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    providers: [
                        {
                            provide: AXMCustomerManagementOpportunityStageEntityService,
                            useClass: AXMCustomerManagementOpportunityStageEntityServiceImpl,
                        },
                    ],
                }]
        }] });

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

class AXMCustomerManagementSalesPipelineEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementSalesPipelineEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementSalesPipelineEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementSalesPipelineEntityModule, providers: [
            {
                provide: AXMCustomerManagementSalesPipelineEntityService,
                useClass: AXMCustomerManagementSalesPipelineEntityServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementSalesPipelineEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    providers: [
                        {
                            provide: AXMCustomerManagementSalesPipelineEntityService,
                            useClass: AXMCustomerManagementSalesPipelineEntityServiceImpl,
                        },
                    ],
                }]
        }] });

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

class AXMCustomerManagementOpportunityEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementOpportunityEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementOpportunityEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementOpportunityEntityModule, providers: [
            {
                provide: AXMCustomerManagementOpportunityEntityService,
                useClass: AXMCustomerManagementOpportunityEntityServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementOpportunityEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    providers: [
                        {
                            provide: AXMCustomerManagementOpportunityEntityService,
                            useClass: AXMCustomerManagementOpportunityEntityServiceImpl,
                        },
                    ],
                }]
        }] });

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

class AXMCustomerManagementActivityEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementActivityEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementActivityEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementActivityEntityModule, providers: [
            {
                provide: AXMCustomerManagementActivityEntityService,
                useClass: AXMCustomerManagementActivityEntityServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementActivityEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    providers: [
                        {
                            provide: AXMCustomerManagementActivityEntityService,
                            useClass: AXMCustomerManagementActivityEntityServiceImpl,
                        },
                    ],
                }]
        }] });

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

class AXMCustomerManagementDealContactRoleEntityModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementDealContactRoleEntityModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementDealContactRoleEntityModule }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementDealContactRoleEntityModule, providers: [
            {
                provide: AXMCustomerManagementDealContactRoleEntityService,
                useClass: AXMCustomerManagementDealContactRoleEntityServiceImpl,
            },
        ] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementDealContactRoleEntityModule, decorators: [{
            type: NgModule,
            args: [{
                    providers: [
                        {
                            provide: AXMCustomerManagementDealContactRoleEntityService,
                            useClass: AXMCustomerManagementDealContactRoleEntityServiceImpl,
                        },
                    ],
                }]
        }] });

const AXM_CUSTOMER_CODE_IDENTIFIER_RULE = {
    id: 'customer-code',
    title: 'Customer Code',
    entity: 'CustomerManagement.Customer',
    pattern: 'CUST-{date:YYYYMM}-{seq:4}',
    enabled: true,
    priority: 1,
    scopeConfig: { byTenant: false, period: 'yearly', minValue: 100, blockSize: 0 },
};

//#region ----   Imports   ----
//#endregion
//#region ----   Permission Keys   ----
const moduleKey = RootConfig.module.name;
const AXMCustomerManagementPermissions = {
    CustomerManagement: {
        Management: `${moduleKey}:Permission:Management`,
        Customer: {
            Management: `${moduleKey}:Permission:Customer.Management`,
            View: `${moduleKey}:Permission:Customer.View`,
            Create: `${moduleKey}:Permission:Customer.Create`,
            Update: `${moduleKey}:Permission:Customer.Update`,
            Delete: `${moduleKey}:Permission:Customer.Delete`,
        },
        Lead: {
            View: `${moduleKey}:Permission:Lead.View`,
        },
        Opportunity: {
            View: `${moduleKey}:Permission:Opportunity.View`,
        },
    },
};
const AXPCustomerManagementPermissionKeys = AXMCustomerManagementPermissions;
//#endregion

class AXMCustomerManagementPermissionDefinitionProvider {
    constructor(injector) {
        this.injector = injector;
    }
    get translateService() {
        return this.injector.get(AXTranslationService);
    }
    async define(context) {
        const trans = async (key) => this.translateService.translateAsync(`@customer-management:permissions.customer-management.${key}`);
        const keys = AXMCustomerManagementPermissions.CustomerManagement;
        context
            .addGroup(RootConfig.module.name, await trans('manage.title'))
            .addPermission(keys.Customer.Management, await trans('customer.manage.title'))
            .addChild(keys.Customer.View, await trans('customer.view.title'))
            .addChild(keys.Customer.Create, await trans('customer.create.title'))
            .addChild(keys.Customer.Update, await trans('customer.update.title'))
            .addChild(keys.Customer.Delete, await trans('customer.delete.title'))
            .endPermission()
            .addPermission(keys.Lead.View, await trans('lead.view.title'))
            .endPermission()
            .addPermission(keys.Opportunity.View, await trans('opportunity.view.title'))
            .endPermission()
            .endGroup();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementPermissionDefinitionProvider, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementPermissionDefinitionProvider }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementPermissionDefinitionProvider, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: i0.Injector }] });

const AXPCustomerManagementMenuKeys = {
    Root: 'CustomerManagement:Menu',
    Customers: 'CustomerManagement:Menu:Customers',
    Leads: 'CustomerManagement:Menu:Leads',
    Opportunities: 'CustomerManagement:Menu:Opportunities',
    OpportunityStages: 'CustomerManagement:Menu:OpportunityStages',
    SalesPipelines: 'CustomerManagement:Menu:SalesPipelines',
    LifecycleStages: 'CustomerManagement:Menu:LifecycleStages',
    SalesTerritories: 'CustomerManagement:Menu:SalesTerritories',
};

class AXMMenuProvider {
    constructor() {
        this.entityService = inject(AXPEntityService);
    }
    async provide(context) {
        const module = RootConfig.module;
        // Add Customers, Leads under Contacts menu
        context.find(AXPCommonMenuKeys.Contacts).addItems([
            {
                name: AXPCustomerManagementMenuKeys.Customers,
                text: '@customer-management:customers.entities.customer.plural',
                path: this.entityService.createPath(module.name, RootConfig.entities.customer.name),
                icon: RootConfig.entities.customer.icon,
                priority: 4,
                policy: {
                    permissions: [AXPCustomerManagementPermissionKeys.CustomerManagement.Customer.View],
                },
            },
            {
                name: AXPCustomerManagementMenuKeys.Leads,
                text: '@customer-management:leads.entities.lead.plural',
                path: this.entityService.createPath(module.name, RootConfig.entities.lead.name),
                icon: RootConfig.entities.lead.icon,
                priority: 5,
                policy: {
                    permissions: [AXPCustomerManagementPermissionKeys.CustomerManagement.Lead.View],
                },
            },
        ]);
    }
}

class AXMCustomerManagementEntityProvider {
    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.customer.name:
                    return (await import('./acorex-modules-customer-management-customer.entity-BOUGKl2b.mjs')).customerFactory(this.injector);
                case RootConfig.entities.lead.name:
                    return (await import('./acorex-modules-customer-management-lead.entity-C-juNxOd.mjs')).leadFactory(this.injector);
                case RootConfig.entities.opportunityStage.name:
                    return (await import('./acorex-modules-customer-management-opportunity-stage.entity-CTTDLeNh.mjs')).opportunityStageFactory(this.injector);
                case RootConfig.entities.salesPipeline.name:
                    return (await import('./acorex-modules-customer-management-sales-pipeline.entity-Bsukn6ZT.mjs')).salesPipelineFactory(this.injector);
                case RootConfig.entities.opportunity?.name:
                    return (await import('./acorex-modules-customer-management-opportunity.entity-xm_yiigj.mjs')).opportunityFactory(this.injector);
                case RootConfig.entities.activity?.name:
                    return (await import('./acorex-modules-customer-management-activity.entity-DzzNvZ8E.mjs')).activityFactory(this.injector);
                // note entity replaced by comments plugin
                case RootConfig.entities.dealContactRole?.name:
                    return (await import('./acorex-modules-customer-management-deal-contact-role.entity-BH03wEMH.mjs')).dealContactRoleFactory(this.injector);
            }
        }
        return null;
    }
    async list() {
        const m = RootConfig.module.name;
        return Promise.resolve(Object.values(RootConfig.entities).map((e) => ({ name: e.name, module: m })));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementEntityProvider, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementEntityProvider }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementEntityProvider, decorators: [{
            type: Injectable
        }] });

class AXMCustomerManagementModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementModule, imports: [AXMCustomerManagementCustomerEntityModule,
            AXMCustomerManagementLeadEntityModule,
            AXMCustomerManagementOpportunityStageEntityModule,
            AXMCustomerManagementSalesPipelineEntityModule,
            AXMCustomerManagementOpportunityEntityModule,
            AXMCustomerManagementActivityEntityModule,
            AXMCustomerManagementDealContactRoleEntityModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementModule, providers: [
            // Module-specific providers (not part of manifest system)
            {
                provide: AXP_IDENTIFIER_RULES,
                multi: true,
                useValue: AXM_CUSTOMER_CODE_IDENTIFIER_RULE,
            },
            // Module Manifest Provider
            {
                provide: AXP_MODULE_MANIFEST_PROVIDER,
                useValue: CustomerManagementManifest,
                multi: true,
            },
            // Provider references (now using tokens)
            {
                provide: AXP_PERMISSION_DEFINITION_PROVIDER,
                useClass: AXMCustomerManagementPermissionDefinitionProvider,
                multi: true,
            },
            {
                provide: AXP_MENU_PROVIDER,
                useClass: AXMMenuProvider,
                multi: true,
            },
            {
                provide: AXP_ENTITY_DEFINITION_LOADER,
                useClass: AXMCustomerManagementEntityProvider,
                multi: true,
            },
        ], imports: [AXMCustomerManagementCustomerEntityModule,
            AXMCustomerManagementLeadEntityModule,
            AXMCustomerManagementOpportunityStageEntityModule,
            AXMCustomerManagementSalesPipelineEntityModule,
            AXMCustomerManagementOpportunityEntityModule,
            AXMCustomerManagementActivityEntityModule,
            AXMCustomerManagementDealContactRoleEntityModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXMCustomerManagementModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [
                        AXMCustomerManagementCustomerEntityModule,
                        AXMCustomerManagementLeadEntityModule,
                        AXMCustomerManagementOpportunityStageEntityModule,
                        AXMCustomerManagementSalesPipelineEntityModule,
                        AXMCustomerManagementOpportunityEntityModule,
                        AXMCustomerManagementActivityEntityModule,
                        AXMCustomerManagementDealContactRoleEntityModule
                    ],
                    providers: [
                        // Module-specific providers (not part of manifest system)
                        {
                            provide: AXP_IDENTIFIER_RULES,
                            multi: true,
                            useValue: AXM_CUSTOMER_CODE_IDENTIFIER_RULE,
                        },
                        // Module Manifest Provider
                        {
                            provide: AXP_MODULE_MANIFEST_PROVIDER,
                            useValue: CustomerManagementManifest,
                            multi: true,
                        },
                        // Provider references (now using tokens)
                        {
                            provide: AXP_PERMISSION_DEFINITION_PROVIDER,
                            useClass: AXMCustomerManagementPermissionDefinitionProvider,
                            multi: true,
                        },
                        {
                            provide: AXP_MENU_PROVIDER,
                            useClass: AXMMenuProvider,
                            multi: true,
                        },
                        {
                            provide: AXP_ENTITY_DEFINITION_LOADER,
                            useClass: AXMCustomerManagementEntityProvider,
                            multi: true,
                        },
                    ],
                }]
        }] });

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

export { AXMCustomerManagementModule, RootConfig };
//# sourceMappingURL=acorex-modules-customer-management.mjs.map
