import type { RoleAssignmentsResponse, RoleProjectMembersResponse } from '@n8n/api-types';
import { CreateRoleDto, UpdateRoleDto } from '@n8n/api-types';
import { LicenseState, Logger } from '@n8n/backend-common';
import { CredentialsEntity, SharedCredentials, SharedWorkflow, User, ListQueryDb, ScopesField, ProjectRelation, RoleRepository, Role, ScopeRepository } from '@n8n/db';
import type { EntityManager } from '@n8n/db';
import type { Scope, Role as RoleDTO, AssignableProjectRole, RoleNamespace } from '@n8n/permissions';
import { RoleCacheService } from './role-cache.service';
export declare class RoleService {
    private readonly license;
    private readonly roleRepository;
    private readonly scopeRepository;
    private readonly roleCacheService;
    private readonly logger;
    constructor(license: LicenseState, roleRepository: RoleRepository, scopeRepository: ScopeRepository, roleCacheService: RoleCacheService, logger: Logger);
    private dbRoleToRoleDTO;
    getAllRoles(withCount?: boolean): Promise<RoleDTO[]>;
    getRole(slug: string, withCount?: boolean): Promise<RoleDTO>;
    getRoleAssignments(slug: string): Promise<RoleAssignmentsResponse>;
    getRoleProjectMembers(slug: string, projectId: string): Promise<RoleProjectMembersResponse>;
    removeCustomRole(slug: string): Promise<{
        displayName: string;
        description: string | null;
        slug: string;
        systemRole: boolean;
        roleType: "credential" | "project" | "workflow" | "global" | "secretsProviderConnection";
        licensed: boolean;
        scopes: string[];
        createdAt?: Date | undefined;
        updatedAt?: Date | undefined;
        usedByUsers?: number | undefined;
        usedByProjects?: number | undefined;
    }>;
    private resolveScopes;
    updateCustomRole(slug: string, newData: UpdateRoleDto): Promise<{
        displayName: string;
        description: string | null;
        slug: string;
        systemRole: boolean;
        roleType: "credential" | "project" | "workflow" | "global" | "secretsProviderConnection";
        licensed: boolean;
        scopes: string[];
        createdAt?: Date | undefined;
        updatedAt?: Date | undefined;
        usedByUsers?: number | undefined;
        usedByProjects?: number | undefined;
    }>;
    createCustomRole(newRole: CreateRoleDto): Promise<{
        displayName: string;
        description: string | null;
        slug: string;
        systemRole: boolean;
        roleType: "credential" | "project" | "workflow" | "global" | "secretsProviderConnection";
        licensed: boolean;
        scopes: string[];
        createdAt?: Date | undefined;
        updatedAt?: Date | undefined;
        usedByUsers?: number | undefined;
        usedByProjects?: number | undefined;
    }>;
    checkRolesExist(roleSlugs: string[], roleType: 'global' | 'project' | 'workflow' | 'credential'): Promise<void>;
    addScopes(rawWorkflow: ListQueryDb.Workflow.WithSharing | ListQueryDb.Workflow.WithOwnedByAndSharedWith, user: User, userProjectRelations: ProjectRelation[]): ListQueryDb.Workflow.WithScopes;
    addScopes(rawCredential: CredentialsEntity, user: User, userProjectRelations: ProjectRelation[]): CredentialsEntity & ScopesField;
    addScopes(rawCredential: ListQueryDb.Credentials.WithSharing | ListQueryDb.Credentials.WithOwnedByAndSharedWith, user: User, userProjectRelations: ProjectRelation[]): ListQueryDb.Credentials.WithScopes;
    combineResourceScopes(type: 'workflow' | 'credential', user: User, shared: SharedCredentials[] | SharedWorkflow[], userProjectRelations: ProjectRelation[]): Scope[];
    rolesWithScope(namespace: RoleNamespace, scopes: Scope | Scope[], trx?: EntityManager): Promise<string[]>;
    isRoleLicensed(role: AssignableProjectRole): boolean;
    addScopesToRole(roleSlug: Role['slug'], scopeSlugs: string[]): Promise<void>;
    removeScopesFromRole(roleSlug: string, scopeSlugs: string[]): Promise<void>;
}
