import { cn } from "@/lib/utils/cn";
import type { SurveyStatus, PlanTier } from "@/types";

type BadgeStatus =
  | SurveyStatus
  | PlanTier
  | "enterprise"
  | "pro"
  | "free";

const statusStyles: Record<BadgeStatus, string> = {
  active: "bg-success-bg text-success",
  draft: "bg-[#F1F5F9] text-muted",
  closed: "bg-danger-bg text-danger",
  pro: "bg-[#EFF6FF] text-primary",
  enterprise: "bg-[#FDF4FF] text-[#A21CAF]",
  free: "bg-[#F1F5F9] text-muted",
};

const statusLabels: Record<BadgeStatus, string> = {
  active: "Active",
  draft: "Draft",
  closed: "Closed",
  pro: "Pro",
  enterprise: "Enterprise",
  free: "Free",
};

interface BadgeProps {
  status: BadgeStatus;
  className?: string;
}

export function Badge({ status, className }: BadgeProps) {
  return (
    <span
      className={cn(
        "inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11.5px] font-bold",
        statusStyles[status],
        className
      )}
    >
      {statusLabels[status]}
    </span>
  );
}
