export const ROLE_OPTIONS = ["admin", "manager", "agent", "collaborator"] as const

const ADMIN_ROLE = "admin"
const STAFF_ROLES = new Set(["admin", "manager", "agent", "collaborator"])

export type RoleOption = (typeof ROLE_OPTIONS)[number]

export function normalizeRole(role?: string | null) {
  return role?.toLowerCase() ?? null
}

export function isAdmin(role?: string | null) {
  return normalizeRole(role) === ADMIN_ROLE
}

export function isStaff(role?: string | null) {
  return STAFF_ROLES.has(normalizeRole(role) ?? "")
}
