import { ITabFlags } from '@ws-ui/shared';
export type TRawData = Partial<{
    privileges: IPrivilege[];
    roles: IRole[];
    permissions: Partial<{
        allowed: IPermission[];
    }>;
    forceLogin: boolean;
    restrictedByDefault: boolean;
}>;
export type TPermissionOption = Pick<IPermission, 'applyTo' | 'type' | 'subType'>;
export type TAction = 'read' | 'create' | 'update' | 'drop' | 'execute' | 'promote';
export type IRolesState = ISanitized & {
    flags: ITabFlags;
    date?: string;
    selectedTab: 'privileges' | 'roles';
    initialState?: {
        roles: TRolesDict;
        privileges: TById;
        forceLogin?: boolean;
        restrictedByDefault?: boolean;
    };
};
export interface IPrivilege {
    id?: string;
    privilege: string;
    includes?: string[];
}
export interface IRole {
    id?: string;
    role: string;
    privileges?: string[];
}
export type TRole = Required<IRole>;
export declare enum EPermissionType {
    DATACLASS = "dataclass",
    METHOD = "method",
    ATTRIBUTE = "attribute",
    DATASTORE = "datastore",
    SINGLETON = "singleton",
    SINGLETON_METHOD = "singletonMethod"
}
export declare enum ESubPermissionType {
    DS_METHOD = "dsMethod",
    DATACLASS_METHOD = "dataclassMethod",
    ENTITY_METHOD = "entityMethod",
    ENTITY_SEL_METHOD = "entityselMethod"
}
export interface IPermission {
    applyTo: string;
    type: EPermissionType | ESubPermissionType;
    subType?: ESubPermissionType;
    read?: string | string[];
    create?: string | string[];
    update?: string | string[];
    drop?: string | string[];
    execute?: string | string[];
    promote?: string | string[];
}
export interface IResourcesByPermission {
    [id: string]: {
        applyTo: IPermission['applyTo'];
        type: IPermission['type'];
        subType?: IPermission['subType'];
    }[];
}
/**
 * Sanitized data
 */
export interface ISanitized {
    privileges: TById;
    roles: TRolesDict;
    forceLogin?: boolean;
    restrictedByDefault?: boolean;
}
export interface IResourcePermission {
    name: TAction;
    from: string[];
    checked?: boolean;
    info?: string;
}
export interface IResource {
    resource: string;
    type: EPermissionType | ESubPermissionType;
    subType?: ESubPermissionType;
    permissions: IResourcePermission[];
    exists?: boolean;
}
export type TSanitizedPrivilege = Required<IPrivilege> & {
    parents: string[];
    resources: IResource[];
};
export type TById = {
    [id: string]: TSanitizedPrivilege;
};
export type TRolesDict = {
    [id: string]: TRole;
};
export interface ILink {
    source: string;
    target: string;
}
export interface IGraphData {
    selected: string;
    parents: string[][];
    children: string[][];
    links: ILink[];
}
