export type PermissionAction = 'view' | 'create' | 'update' | 'delete' | 'approve' | 'export';

export const PERMISSION_ACTIONS: PermissionAction[] =
  ['view', 'create', 'update', 'delete', 'approve', 'export'];

/** flat 변환된 권한 맵 (프론트엔드 사용) */
export interface PermissionMap {
  [url: string]: {
    [key in PermissionAction]?: boolean;
  };
}

/** usePermission 훅 반환 타입 */
export interface UsePermissionReturn {
  canView: boolean;
  canCreate: boolean;
  canUpdate: boolean;
  canDelete: boolean;
  canApprove: boolean;
  canExport: boolean;
  isLoading: boolean;
  matchedUrl: string | null;
}

export const ALL_ALLOWED: UsePermissionReturn = {
  canView: true, canCreate: true, canUpdate: true,
  canDelete: true, canApprove: true, canExport: true,
  isLoading: false, matchedUrl: null,
};

export const ALL_DENIED_PERMS: Record<PermissionAction, false> = {
  view: false, create: false, update: false,
  delete: false, approve: false, export: false,
};
