import { s } from "bknd/utils";
import { Permission } from "./Permission";
import { Policy } from "./Policy";
export declare const rolePermissionSchema: s.ObjectSchema<{
    readonly permission: s.StringSchema<s.IStringOptions> & s.IStringOptions;
    readonly effect: {
        readonly default: "allow";
        readonly enum: ["allow", "deny"];
    } & s.Schema<s.ISchemaOptions, "allow" | "deny" | undefined, "allow" | "deny" | undefined>;
    readonly policies: {
        default?: any;
        enum?: (readonly any[] | any[]) | undefined;
        const?: any;
        $defs?: Record<string, s.Schema> | undefined;
        contains?: s.Schema | undefined;
        minContains?: number | undefined;
        maxContains?: number | undefined;
        prefixItems?: s.Schema[] | undefined;
        uniqueItems?: boolean | undefined;
        maxItems?: number | undefined;
        minItems?: number | undefined;
        readonly items?: s.ObjectSchema<{
            readonly description: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>;
            readonly condition: s.Schema<{}, import("../../core/object/query/object-query").ObjectQuery | undefined>;
            readonly effect: s.Schema<s.ISchemaOptions, "filter" | "allow" | "deny" | undefined, "filter" | "allow" | "deny" | undefined>;
            readonly filter: s.Schema<{}, import("../../core/object/query/object-query").ObjectQuery | undefined>;
        }, s.Merge<s.IObjectOptions & {
            additionalProperties: false;
        }>> | undefined;
    } & s.Schema<s.ISchemaOptions, {
        description?: string | undefined;
        filter?: import("../../core/object/query/object-query").ObjectQuery | undefined;
        effect?: "filter" | "allow" | "deny" | undefined;
        condition?: import("../../core/object/query/object-query").ObjectQuery | undefined;
    }[] | undefined, {
        description?: string | undefined;
        filter?: import("../../core/object/query/object-query").ObjectQuery | undefined;
        effect?: "filter" | "allow" | "deny" | undefined;
        condition?: import("../../core/object/query/object-query").ObjectQuery | undefined;
    }[] | undefined>;
}, s.Merge<s.IObjectOptions & {
    additionalProperties: false;
}>>;
export type RolePermissionSchema = s.Static<typeof rolePermissionSchema>;
export declare const roleSchema: s.ObjectSchema<{
    readonly permissions: {
        default?: any;
        enum?: (readonly any[] | any[]) | undefined;
        const?: any;
        anyOf: [s.ArraySchema<s.StringSchema<s.IStringOptions> & s.IStringOptions, s.Schema<s.ISchemaOptions, unknown, unknown>> & s.Schema<s.ISchemaOptions, unknown, unknown>, s.ArraySchema<s.ObjectSchema<{
            readonly permission: s.StringSchema<s.IStringOptions> & s.IStringOptions;
            readonly effect: {
                readonly default: "allow";
                readonly enum: ["allow", "deny"];
            } & s.Schema<s.ISchemaOptions, "allow" | "deny" | undefined, "allow" | "deny" | undefined>;
            readonly policies: {
                default?: any;
                enum?: (readonly any[] | any[]) | undefined;
                const?: any;
                $defs?: Record<string, s.Schema> | undefined;
                contains?: s.Schema | undefined;
                minContains?: number | undefined;
                maxContains?: number | undefined;
                prefixItems?: s.Schema[] | undefined;
                uniqueItems?: boolean | undefined;
                maxItems?: number | undefined;
                minItems?: number | undefined;
                readonly items?: s.ObjectSchema<{
                    readonly description: s.Schema<s.ISchemaOptions, string | undefined, string | undefined>;
                    readonly condition: s.Schema<{}, import("../../core/object/query/object-query").ObjectQuery | undefined>;
                    readonly effect: s.Schema<s.ISchemaOptions, "filter" | "allow" | "deny" | undefined, "filter" | "allow" | "deny" | undefined>;
                    readonly filter: s.Schema<{}, import("../../core/object/query/object-query").ObjectQuery | undefined>;
                }, s.Merge<s.IObjectOptions & {
                    additionalProperties: false;
                }>> | undefined;
            } & s.Schema<s.ISchemaOptions, {
                description?: string | undefined;
                filter?: import("../../core/object/query/object-query").ObjectQuery | undefined;
                effect?: "filter" | "allow" | "deny" | undefined;
                condition?: import("../../core/object/query/object-query").ObjectQuery | undefined;
            }[] | undefined, {
                description?: string | undefined;
                filter?: import("../../core/object/query/object-query").ObjectQuery | undefined;
                effect?: "filter" | "allow" | "deny" | undefined;
                condition?: import("../../core/object/query/object-query").ObjectQuery | undefined;
            }[] | undefined>;
        }, s.Merge<s.IObjectOptions & {
            additionalProperties: false;
        }>>, s.Schema<s.ISchemaOptions, unknown, unknown>> & s.Schema<s.ISchemaOptions, unknown, unknown>];
    } & s.Schema<s.ISchemaOptions, string[] | {
        effect?: "allow" | "deny" | undefined;
        policies?: {
            description?: string | undefined;
            filter?: import("../../core/object/query/object-query").ObjectQuery | undefined;
            effect?: "filter" | "allow" | "deny" | undefined;
            condition?: import("../../core/object/query/object-query").ObjectQuery | undefined;
        }[] | undefined;
        permission: string;
    }[] | undefined, any>;
    readonly is_default: {
        default?: any;
        enum?: (readonly any[] | any[]) | undefined;
        const?: any;
    } & s.Schema<s.ISchemaOptions, boolean | undefined, boolean | undefined>;
    readonly implicit_allow: {
        default?: any;
        enum?: (readonly any[] | any[]) | undefined;
        const?: any;
    } & s.Schema<s.ISchemaOptions, boolean | undefined, boolean | undefined>;
}, s.Merge<s.IObjectOptions & {
    additionalProperties: false;
}>>;
export type RoleSchema = s.Static<typeof roleSchema>;
export declare class RolePermission {
    permission: Permission<any, any, any, any>;
    policies: Policy[];
    effect: "allow" | "deny";
    constructor(permission: Permission<any, any, any, any>, policies?: Policy[], effect?: "allow" | "deny");
    toJSON(): {
        permission: any;
        policies: {
            description?: string | undefined;
            filter?: import("../../core/object/query/object-query").ObjectQuery | undefined;
            effect?: "filter" | "allow" | "deny" | undefined;
            condition?: import("../../core/object/query/object-query").ObjectQuery | undefined;
        }[];
        effect: "allow" | "deny";
    };
}
export declare class Role {
    name: string;
    permissions: RolePermission[];
    is_default: boolean;
    implicit_allow: boolean;
    constructor(name: string, permissions?: RolePermission[], is_default?: boolean, implicit_allow?: boolean);
    static create(name: string, config: RoleSchema): Role;
    toJSON(): {
        permissions: {
            permission: any;
            policies: {
                description?: string | undefined;
                filter?: import("../../core/object/query/object-query").ObjectQuery | undefined;
                effect?: "filter" | "allow" | "deny" | undefined;
                condition?: import("../../core/object/query/object-query").ObjectQuery | undefined;
            }[];
            effect: "allow" | "deny";
        }[];
        is_default: boolean;
        implicit_allow: boolean;
    };
}
