import { TONE_CLASSES, orderStatusTone, rfqStatusTone } from "@/lib/status";

/** A status pill coloured by its canonical code; the text is the API's label. */
export default function StatusBadge({
  kind,
  code,
  label,
  className = "",
}: {
  kind: "order" | "rfq";
  code: string | null | undefined;
  label: string | null | undefined;
  className?: string;
}) {
  const tone = kind === "order" ? orderStatusTone(code) : rfqStatusTone(code);
  return (
    <span className={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold ring-1 ${TONE_CLASSES[tone]} ${className}`}>
      {label || "—"}
    </span>
  );
}
