"use client";

import { Badge } from "@/components/ds";
import { cn } from "@/lib/utils";
import { appointmentStatusTone } from "./tokens";

const statusLabels: Record<string, string> = {
  requested: "درخواست",
  confirmed: "تأیید شده",
  checked_in: "پذیرش",
  in_progress: "در حال انجام",
  completed: "انجام شد",
  cancelled: "لغو",
  no_show: "عدم حضور",
  draft: "پیش‌نویس",
  active: "فعال",
  inactive: "غیرفعال",
  suspended: "معلق",
  archived: "آرشیو",
  available: "آزاد",
  occupied: "اشغال",
  maintenance: "تعمیر",
};

type Domain = "appointment" | "lifecycle" | "resource" | "generic";

export function BeautyStatusChip({
  status,
  domain = "generic",
  className,
}: {
  status: string;
  domain?: Domain;
  className?: string;
}) {
  const tone =
    domain === "appointment"
      ? appointmentStatusTone[status] ?? "default"
      : status === "active" || status === "completed"
        ? "success"
        : status === "cancelled"
          ? "danger"
          : "default";

  return (
    <Badge tone={tone} className={cn("font-medium", className)}>
      {statusLabels[status] ?? status}
    </Badge>
  );
}
