import { cn } from "@/lib/utils";

type StatusType =
  | "en_ruta"
  | "riesgo"
  | "vencido"
  | "completado"
  | "completada"
  | "proxima"
  | "actualizado"
  | "pendiente";

type StatusPillProps = {
  status: StatusType;
  className?: string;
};

const statusMap: Record<
  StatusType,
  { label: string; className: string }
> = {
  en_ruta: {
    label: "En ruta",
    className: "bg-benell-tan/70 text-benell-brown",
  },
  riesgo: {
    label: "Riesgo",
    className: "bg-benell-brown text-white",
  },
  vencido: {
    label: "Vencido",
    className: "bg-benell-red text-white",
  },
  completado: {
    label: "Completado",
    className: "bg-green-100 text-green-700",
  },
  completada: {
    label: "Completada",
    className: "bg-green-100 text-green-700",
  },
  proxima: {
    label: "Próxima",
    className: "bg-benell-brown text-white",
  },
  actualizado: {
    label: "Actualizado",
    className: "bg-emerald-100 text-emerald-700",
  },
  pendiente: {
    label: "Pendiente",
    className: "bg-amber-100 text-amber-700",
  },
};

export default function StatusPill({ status, className }: StatusPillProps) {
  const current = statusMap[status];

  return (
    <span
      className={cn(
        "inline-flex items-center rounded-pill px-3 py-1 text-sm font-semibold",
        current.className,
        className
      )}
    >
      {current.label}
    </span>
  );
}
