import { AXTranslationService } from '@acorex/core/translation';

const AXMPermissionsKeys = {
    DocumentManagement: {
        Management: 'document-management:manage',
        DocumentType: {
            Management: 'document-management:document-type:manage',
            View: 'document-management:document-type:view',
            Edit: 'document-management:document-type:edit',
            Delete: 'document-management:document-type:delete',
            Create: 'document-management:document-type:create',
        },
        Driver: {
            Management: 'document-management:driver:manage',
            View: 'document-management:driver:view',
            Edit: 'document-management:driver:edit',
            Delete: 'document-management:driver:delete',
            Create: 'document-management:driver:create',
        },
        Review: {
            Management: 'document-management:review:manage',
            View: 'document-management:review:view',
            Edit: 'document-management:review:edit',
            Delete: 'document-management:review:delete',
            Create: 'document-management:document-type:create',
        },
        Distribution: {
            Management: 'document-management:distribution:manage',
            View: 'document-management:distribution:view',
            Edit: 'document-management:distribution:edit',
            Delete: 'document-management:distribution:delete',
            Create: 'document-management:distribution:create',
        },
        DistributionInteraction: {
            Management: 'document-management:distribution-interaction:manage',
            View: 'document-management:distribution-interaction:view',
            Edit: 'document-management:distribution-interaction:edit',
            Delete: 'document-management:distribution-interaction:delete',
            Create: 'document-management:distribution-interaction:create',
        },
    },
};

class AXMPermissionDefinitionProvider {
    constructor(injector) {
        this.injector = injector;
        this.translateService = this.injector.get(AXTranslationService);
    }
    async define(context) {
        const trans = async (key) => await this.translateService.translateAsync(`@document-management:permissions.${key}`);
        const keys = AXMPermissionsKeys.DocumentManagement;
        context.addGroup(keys.Management, await trans('manage.title'), await trans('manage.description'))
            //  
            .addPermission(keys.DocumentType.Management, await trans('document-type.manage.title'), await trans('document-type.manage.description'))
            .addChild(keys.DocumentType.View, await trans('document-type.view.title'), await trans('document-type.view.description'))
            .addChild(keys.DocumentType.Edit, await trans('document-type.edit.title'), await trans('document-type.edit.description'))
            .addChild(keys.DocumentType.Delete, await trans('document-type.delete.title'), await trans('document-type.delete.description'))
            .addChild(keys.DocumentType.Create, await trans('document-type.create.title'), await trans('document-type.create.description'))
            .endPermission()
            //
            .addPermission(keys.Driver.Management, await trans('driver.manage.title'), await trans('driver.manage.description'))
            .addChild(keys.Driver.View, await trans('driver.view.title'), await trans('driver.view.description'))
            .addChild(keys.Driver.Edit, await trans('driver.edit.title'), await trans('driver.edit.description'))
            .addChild(keys.Driver.Delete, await trans('driver.delete.title'), await trans('driver.delete.description'))
            .addChild(keys.Driver.Create, await trans('driver.create.title'), await trans('driver.create.description'))
            .endPermission()
            //
            .addPermission(keys.Review.Management, await trans('review.manage.title'), await trans('review.manage.description'))
            .addChild(keys.Review.View, await trans('review.view.title'), await trans('review.view.description'))
            .addChild(keys.Review.Edit, await trans('review.edit.title'), await trans('review.edit.description'))
            .addChild(keys.Review.Delete, await trans('review.delete.title'), await trans('review.delete.description'))
            .addChild(keys.Review.Create, await trans('review.create.title'), await trans('review.create.description'))
            .endPermission();
        //
    }
}

export { AXMPermissionDefinitionProvider };
//# sourceMappingURL=acorex-modules-document-management-permission-definition.provider-C_npYeuU.mjs.map
