import { STAGE_LABEL, type Stage } from "@/lib/constants";
import { cn } from "@/lib/utils";

const TONE: Record<Stage, string> = {
  identified: "bg-muted text-muted-foreground",
  contacted: "bg-info/15 text-info",
  meeting: "bg-primary/15 text-primary",
  proposal: "bg-warning/15 text-warning",
  gift: "bg-success/15 text-success",
  holding: "bg-warning/15 text-warning",
  declined: "bg-destructive/15 text-destructive",
  dormant: "bg-muted text-muted-foreground",
};

export function StageBadge({ stage }: { stage: Stage | string }) {
  const s = stage as Stage;
  return (
    <span
      className={cn(
        "inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium uppercase tracking-wide",
        TONE[s] ?? TONE.identified,
      )}
    >
      {STAGE_LABEL[s] ?? stage}
    </span>
  );
}
