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

const STATUS_MAP: Record<string, { label: string; variant: "success" | "default" | "danger" | "warning" }> = {
  active:    { label: "Active",    variant: "success" },
  inactive:  { label: "Inactive",  variant: "default" },
  deleted:   { label: "Deleted",   variant: "danger" },
  suspended: { label: "Suspended", variant: "warning" },
};

interface BrandStatusBadgeProps {
  status: string | null | undefined;
  hideIfActive?: boolean;
}

export function BrandStatusBadge({ status, hideIfActive }: BrandStatusBadgeProps) {
  const normalized = (status ?? "active").toLowerCase();
  if (hideIfActive && normalized === "active") return null;
  const { label, variant } = STATUS_MAP[normalized] ?? STATUS_MAP.active;
  return <Badge variant={variant}>{label}</Badge>;
}
