/**
 * The client's six ranks, written the way they write them.
 *
 * Pure and dependency-free on purpose: the column definitions are a client
 * component, and importing this from the positions service would pull the
 * database client into the browser bundle.
 */

export const LEVELS = [
  "admin",
  "manager",
  "assistant_manager",
  "supervisor",
  "line_leader",
  "staff",
] as const

export type Level = (typeof LEVELS)[number]

export const LEVEL_LABELS: Record<Level, string> = {
  admin: "Admin",
  manager: "Manager",
  assistant_manager: "Assistant Manager",
  supervisor: "Supervisor",
  line_leader: "Line Leader",
  staff: "Staff",
}

/** Highest first, which is the order an org chart is read in. */
export function rankOf(level: Level): number {
  return LEVELS.indexOf(level)
}
