import { Exception } from "../../core/errors";
import type { Permission, PermissionContext } from "../../auth/authorize/Permission";
import type { Context } from "hono";
import type { ServerEnv } from "../../modules/Controller";
import type { Role } from "./Role";
import { HttpStatus } from "bknd/utils";
import type { Policy } from "./Policy";
import { type ObjectQuery } from "../../core/object/query/object-query";
export type GuardUserContext = {
    role?: string | null;
    [key: string]: any;
};
export type GuardConfig = {
    enabled?: boolean;
    context?: object;
};
export type GuardContext = Context<ServerEnv> | GuardUserContext;
export declare class GuardPermissionsException extends Exception {
    permission: Permission;
    policy?: Policy | undefined;
    description?: string | undefined;
    name: string;
    code: HttpStatus;
    constructor(permission: Permission, policy?: Policy | undefined, description?: string | undefined);
    toJSON(): any;
}
export declare class Guard {
    permissions: Permission<any, any, any, any>[];
    roles: Role[];
    config?: GuardConfig | undefined;
    constructor(permissions?: Permission<any, any, any, any>[], roles?: Role[], config?: GuardConfig | undefined);
    getPermissionNames(): string[];
    getPermissions(): Permission[];
    permissionExists(permissionName: string): boolean;
    setRoles(roles: Role[]): this;
    getRoles(): Role[];
    setConfig(config: Partial<GuardConfig>): this;
    registerPermission(permission: Permission<any, any, any, any>): this;
    registerPermissions(permissions: Record<string, Permission<any, any, any, any>>): any;
    registerPermissions(permissions: Permission<any, any, any, any>[]): any;
    getUserRole(user?: GuardUserContext): Role | undefined;
    getDefaultRole(): Role | undefined;
    isEnabled(): boolean;
    private collect;
    granted<P extends Permission<any, any, any, any>>(permission: P, c: GuardContext, context: PermissionContext<P>): void;
    granted<P extends Permission<any, any, undefined, any>>(permission: P, c: GuardContext): void;
    filters<P extends Permission<any, any, any, any>>(permission: P, c: GuardContext, context: PermissionContext<P>): any;
    filters<P extends Permission<any, any, undefined, any>>(permission: P, c: GuardContext): any;
}
export declare function mergeFilters(base: ObjectQuery, priority: ObjectQuery): any;
