import type { TodoStatus, TodoPriority, TodoRecurrence } from "@/models/Todo";

export const STATUS_LABELS: Record<TodoStatus, string> = {
  open: "Offen",
  in_progress: "In Bearbeitung",
  done: "Erledigt",
};

export const PRIORITY_LABELS: Record<TodoPriority, string> = {
  low: "Niedrig",
  normal: "Normal",
  high: "Hoch",
};

export const PRIORITY_COLORS: Record<TodoPriority, string> = {
  low: "#94a3b8",
  normal: "#38bdf8",
  high: "#f87171",
};

export const PRIORITY_RANK: Record<TodoPriority, number> = { high: 0, normal: 1, low: 2 };
export const STATUS_RANK: Record<TodoStatus, number> = { open: 0, in_progress: 1, done: 2 };

export const RECURRENCE_LABELS: Record<TodoRecurrence, string> = {
  none: "Einmalig",
  daily: "Täglich",
  weekly: "Wöchentlich",
  monthly: "Monatlich",
};

// Deterministische Farbe pro Label-Name (kein eigenes Label-Modell nötig) —
// gleiche Schreibweise ⇒ gleiche Farbe.
export function labelColor(name: string): string {
  let h = 0;
  for (let i = 0; i < name.length; i++) h = (h * 31 + name.charCodeAt(i)) % 360;
  return `hsl(${h} 50% 62%)`;
}
