import { AccessPayload } from '../types';

export interface AuthRoleConfig<T extends Record<string, string>> {
    decodedAccessToken: AccessPayload | null;
    role: T;
}
export type RoleKey<T extends Record<string, string>> = keyof T;
type SnakeToCamel<S extends string> = S extends `${infer F}_${infer R}` ? `${Capitalize<Lowercase<F>>}${SnakeToCamel<R>}` : Capitalize<Lowercase<S>>;
type RoleFlags<T extends Record<string, string>> = {
    [K in keyof T as `is${SnakeToCamel<K & string>}`]: boolean;
};
type UseAuthRoleReturn<T extends Record<string, string>> = RoleFlags<T> & {
    hasRole: (role: keyof T) => boolean;
    getRoleKey: () => string;
};
/**
 * Generic hook untuk role-based access
 *
 * Example:
 *
 *  import { APP_CONFIG } from "@core/configs/app";
 *
 * const ROLE_CODE = {
 *   OWNER: APP_CONFIG.role.owner,
 *   PRODUCT_MANAGER: APP_CONFIG.role.productManager,
 *   FINANCE: APP_CONFIG.role.finance,
 * };
 *
 * const { isOwner, isFinance, hasRole, getRoleKey } = useAuthRole({
 *    decodedAccessToken: decodedAccessToken,
 *    role: ROLE_CODE,
 * });
 */
export declare function useAuthRole<T extends Record<string, string>>(config: AuthRoleConfig<T>): UseAuthRoleReturn<T>;
export {};
