import { type RawRule, Ability } from "@casl/ability";
import { type Component } from "vue";
import { type RouteLocationNormalizedLoaded, type Router } from "vue-router";
import type { FmpUser } from "@/store";
export declare namespace Permission {
    enum Level {
        feedMe = 0,
        business = 1,
        restaurant = 2
    }
    enum Action {
        manage = "manage",
        create = "create",
        read = "read",
        update = "update",
        delete = "delete"
    }
}
export declare namespace Permission.Subject {
    enum Feedme {
        all = "all",
        restaurant = "restaurant",
        business = "business",
        delivery = "delivery",
        agent = "agent"
    }
    enum FeedmeBusinessField {
        quota = "quota",
        owner = "owner"
    }
    enum Business {
        profile = "business::profile",
        restaurant = "business::restaurant",
        menu = "business::menu",
        promotion = "business::promotion",
        voucher = "business::voucher",
        membership = "business::membership",
        stock = "business::stock",
        permission = "business::permission",
        role = "business::role",
        wastageTemplate = "business::wastageTemplate",
        closingTemplate = "business::closingTemplate",
        orderTemplate = "business::orderTemplate",
        ingredient = "business::ingredient",
        recipe = "business::recipe",
        unit = "business::unit",
        supplier = "business::supplier",
        warehouse = "business::warehouse",
        publish = "business::publish",
        integration = "business::integration",
        orderDraft = "business::orderDraft",
        unitCostHistory = "business::unitCostHistory"
    }
    enum Restaurant {
        restaurant = "restaurant"
    }
}
export interface AbilityConstructOption {
    userId: string;
    level: number;
    role: string;
    businessId?: string;
    restaurantId?: string;
}
export interface PermissionLevelDetail {
    isAdmin: (perviousLevel: Ability, option: AbilityConstructOption) => boolean;
    getRules: (options: AbilityConstructOption) => Promise<RawRule[]>;
}
export declare const fullPermission: {
    [key: string]: IFdtoPortalPermission;
};
export interface IFdtoPortalPermission extends RawRule {
    label: string;
}
export interface IPermissionUser {
    businessId: string;
    userId: string;
    /** @deprecated */
    email?: string;
    /** @deprecated */
    phoneNumber?: string;
    permissions: RawRule[];
}
export type Role = "admin" | "staff" | "agent" | "debug";
export interface CaslPermission {
    action: Permission.Action | (string & {});
    subject: Permission.Subject.Business | Permission.Subject.Restaurant | Permission.Subject.Feedme | Permission.Subject.FeedmeBusinessField | (string & {});
    field?: string;
}
export interface ValidationResult {
    canAccess: boolean;
    message?: string;
}
export interface ValidationManifest {
    requiredRoles?: Role[];
    requiredCaslPermissions?: CaslPermission[];
    customValidationFunction?: () => Promise<ValidationResult>;
}
export interface ValidationParams {
    sessionUser: FmpUser | null | undefined;
    validationManifest: ValidationManifest;
}
export declare function validate(params: ValidationParams): Promise<ValidationResult>;
export interface RouteValidationResult extends ValidationResult {
    redirectTo?: string;
}
declare module "vue-router" {
    interface RouteMeta {
        validationManifest?: ValidationManifest;
    }
}
export declare function validateRoute(route: RouteLocationNormalizedLoaded): Promise<RouteValidationResult>;
export declare function installRouteValidation(router: Router): void;
export declare function withPermission(Comp: Component): {
    render: () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
        [key: string]: any;
    }>;
};
//# sourceMappingURL=permission.d.ts.map