export interface User {
  email: string
  name: string
  is_admin: boolean
  caps: string[]
  // Archive compat — not provided by central auth but referenced by existing components
  id?: number
  kitchen_id?: number
  kitchen_name?: string
}

export function can(user: User | null, cap: string): boolean {
  if (!user) return false
  return user.is_admin || user.caps.includes(cap)
}
