import type { LeadStatus, LeadScore } from "@/types";

export const LEAD_CATEGORIES = [
  "Gebrauchtwagenhandel",
  "Handwerker",
  "Küche & Bad",
  "Immobilien",
  "IT / Software",
  "Marketing & Werbung",
  "Gastronomie",
  "Gesundheit & Beauty",
  "E-Commerce",
  "Beratung",
  "Sonstiges",
] as const;

export const LEAD_SOURCES = [
  "Website",
  "Empfehlung",
  "Kaltakquise",
  "Social Media",
  "Messe / Event",
  "Partnerschaft",
  "Sonstiges",
] as const;

export const LEAD_STATUSES: { value: LeadStatus; label: string; color: string; bg: string }[] = [
  { value: "neu",          label: "Neu",          color: "text-sky-400",    bg: "bg-sky-400/10 border-sky-400/20" },
  { value: "kontaktiert",  label: "Kontaktiert",  color: "text-yellow-400", bg: "bg-yellow-400/10 border-yellow-400/20" },
  { value: "angebot",      label: "Angebot",      color: "text-violet-400", bg: "bg-violet-400/10 border-violet-400/20" },
  { value: "gewonnen",     label: "Gewonnen",     color: "text-emerald-400",bg: "bg-emerald-400/10 border-emerald-400/20" },
  { value: "verloren",     label: "Verloren",     color: "text-red-400",    bg: "bg-red-400/10 border-red-400/20" },
];

export const LEAD_SCORES: { value: LeadScore; label: string; emoji: string; color: string }[] = [
  { value: "cold", label: "Kalt", emoji: "❄️", color: "text-sky-400" },
  { value: "warm", label: "Warm", emoji: "🌡️", color: "text-yellow-400" },
  { value: "hot",  label: "Heiß", emoji: "🔥", color: "text-orange-400" },
];

export function getStatusMeta(status: LeadStatus) {
  return LEAD_STATUSES.find((s) => s.value === status)!;
}

export function getScoreMeta(score: LeadScore) {
  return LEAD_SCORES.find((s) => s.value === score)!;
}

export function formatValue(v: number | null | undefined): string {
  if (v == null) return "—";
  return new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR", maximumFractionDigits: 0 }).format(v);
}
