declare type Check = {
    operation: 'validator';
    method?: string;
    variables?: Record<string, [string, string]>;
} | CheckWithOperand;

declare type CheckWithOperand = {
    operation: 'ifEqual' | 'ifContains';
    fields: string[][];
};

declare type ColumnGrantJson = string | {
    field: string;
    permission: string;
};

export declare type GetGrandParams<T extends object = any, RequestObject = any> = {
    role: string;
    request: T;
    validations?: Record<string, RabValidationFn<RequestObject>>;
    permission: string;
};

declare type GrantColumn = Array<string | {
    field: string;
    columns: string[];
}>;

declare type GrantJson = {
    role: string;
    columns?: Array<ColumnGrantJson>;
    lookupFilters?: Record<string, Record<string, string[]>>;
    filters?: Record<string, any>;
    check?: Check[];
    extends?: {
        permission: string;
        role: string;
    };
};

export declare type PermissionGrant = {
    isAuthorized: boolean;
    filters?: Record<string, string>;
    fields?: GrantColumn;
    lookupFilters?: Record<string, string>;
};

export declare class Rab {
    private readonly permissionMap;
    constructor(config: Record<string, RabGrant[]>);
    get permissions(): Record<string, RabGrant[]>;
    static schema(config: Record<string, RabGrant[]>): Rab;
    static grant(role: string): RabGrant;
    static auth(path: string[] | string): string[];
    static params(path: string[] | string): string[];
    static query(path: string[] | string): string[];
    resolvePermissions(permission: string, role: string): ResolvedGrant;
    getGrant(options: GetGrandParams): Promise<PermissionGrant>;
}

export declare class RabGrant {
    role: string;
    private _columns?;
    private _lookupFilters?;
    private _filters?;
    private _checks?;
    private _extends?;
    constructor(role: string);
    columns(columns: ColumnGrantJson[]): this;
    lookupFilters(filters: Record<string, Record<string, string[]>>): this;
    filters(filters: Record<string, any>): this;
    ifEqual(fieldOne: string[], fieldTwo: string[]): this;
    ifContains(fieldOne: string[], fieldTwo: string[]): this;
    validator(method: string): this;
    extend(role: string, permission: string): this;
    get json(): GrantJson;
    get getColumns(): ColumnGrantJson[] | undefined;
    get extendsConfig(): {
        permission: string;
        role: string;
    } | undefined;
}

export declare type RabValidationFn<RequestObject = any> = (request: RequestObject) => Promise<void>;

declare type ResolvedGrant = Omit<GrantJson, 'columns'> & {
    columns?: GrantColumn;
};

export { }
