import { cx } from "./primitives";

const statusClasses: Record<string, string> = {
  Pending: "bg-yellow-100 text-yellow-700",
  Analyzing: "bg-blue-100 text-blue-700",
  Developing: "bg-purple-100 text-purple-700",
  Done: "bg-green-100 text-green-700",
  Error: "bg-red-100 text-red-700",
  Cancelled: "bg-gray-100 text-gray-500",
};

export function ticketStatusClass(status: string): string {
  return statusClasses[status] ?? "bg-gray-100 text-gray-700";
}

interface TicketStatusBadgeProps {
  status: string;
  className?: string;
}

export default function TicketStatusBadge({ status, className }: TicketStatusBadgeProps) {
  return (
    <span
      className={cx(
        "rounded-full px-2 py-0.5 text-xs font-medium",
        ticketStatusClass(status),
        className
      )}
    >
      {status}
    </span>
  );
}
