const statusStyles: Record<string, { label: string; className: string }> = {
  pending: { label: "Vorgeschlagen", className: "bg-anouma-sand/60 text-anouma-plum" },
  confirmed: { label: "Bestätigt", className: "bg-anouma-sage/30 text-anouma-moss" },
  rejected: { label: "Abgelehnt", className: "bg-red-100 text-red-800" },
  cancelled: { label: "Storniert", className: "bg-anouma-taupe/30 text-anouma-plum/70" },
  past: { label: "Vergangen", className: "bg-anouma-taupe/20 text-anouma-plum/60" },
};

export function BookingStatusBadge({ status }: { status: string }) {
  const style = statusStyles[status] ?? statusStyles.pending;
  return (
    <span className={`inline-flex items-center rounded-full px-3 py-1 text-xs font-medium ${style.className}`}>
      {style.label}
    </span>
  );
}

export function resolveDisplayStatus(status: string, dateISO: string): string {
  if ((status === "pending" || status === "confirmed") && new Date(dateISO) < new Date()) {
    return "past";
  }
  return status;
}
