// Voll deckende Balken-/Punkt-Farben je Rolle — abgeleitet aus den Badge-Tönen in
// lib/roleMeta.ts, aber solide (für die Maschinenraum-Speicherleiste). Design-Sprache:
// Hirn=Indigo, Gedächtnis=Smaragd, Augen=Pink, Groß=Bernstein, Coder=Violett/Fuchsia.
export interface RoleBarColor {
  bar: string   // Segment-Füllung (solide)
  dot: string   // Legenden-Punkt
  text: string  // Akzent-Text
}

const BY_ROLE: Record<string, RoleBarColor> = {
  hermes: { bar: "bg-indigo-500", dot: "bg-indigo-500", text: "text-indigo-400" },
  embed: { bar: "bg-emerald-500", dot: "bg-emerald-500", text: "text-emerald-400" },
  vision: { bar: "bg-pink-500", dot: "bg-pink-500", text: "text-pink-400" },
  heavy: { bar: "bg-amber-500", dot: "bg-amber-500", text: "text-amber-400" },
  "coder-lite": { bar: "bg-violet-500", dot: "bg-violet-500", text: "text-violet-400" },
  coder: { bar: "bg-fuchsia-500", dot: "bg-fuchsia-500", text: "text-fuchsia-400" },
  scout: { bar: "bg-teal-500", dot: "bg-teal-500", text: "text-teal-400" },
  kritiker: { bar: "bg-cyan-500", dot: "bg-cyan-500", text: "text-cyan-400" },
  reranker: { bar: "bg-lime-500", dot: "bg-lime-500", text: "text-lime-400" },
}

const ALIAS: Record<string, string> = { fast: "hermes", coder_lite: "coder-lite" }

const UNASSIGNED: RoleBarColor = { bar: "bg-slate-400", dot: "bg-slate-400", text: "text-slate-300" }

export function roleBarColor(role?: string | null): RoleBarColor {
  if (!role) return UNASSIGNED
  return BY_ROLE[role] || BY_ROLE[ALIAS[role]] || UNASSIGNED
}
