import { Badge } from "@/components/ui/badge";
import { cn } from "@/lib/utils";

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

export function StatusBadge({ status, className }: StatusBadgeProps) {
  const normalized = status.toLowerCase();
  
  let variantClass = "bg-slate-100 text-slate-800 border-slate-200";
  let label = status;

  if (normalized === "pending" || normalized === "todo") {
    variantClass = "bg-amber-100 text-amber-800 border-amber-200";
    label = "Pending";
  } else if (normalized === "in_progress" || normalized === "active") {
    variantClass = "bg-blue-100 text-blue-800 border-blue-200";
    label = normalized === "active" ? "Active" : "In Progress";
  } else if (normalized === "completed" || normalized === "done") {
    variantClass = "bg-emerald-100 text-emerald-800 border-emerald-200";
    label = "Completed";
  } else if (normalized === "suspended" || normalized === "inactive") {
    variantClass = "bg-rose-100 text-rose-800 border-rose-200";
    label = normalized === "suspended" ? "Suspended" : "Inactive";
  }

  return (
    <Badge variant="outline" className={cn("capitalize px-2.5 py-0.5 font-medium border", variantClass, className)}>
      {label}
    </Badge>
  );
}
