import { StatusBadge } from "@/components/ui/badge";
import type { PortalPaymentStatus } from "@/types/portal";

/**
 * `unpaid` is a warning, not a failure: on a cash-on-delivery order it is simply how every order
 * starts, and drawing it like an error would make a whole list look broken. `refunded` is neutral -
 * somebody decided it, and there is nothing left to chase.
 */
const VARIANT = {
  paid: "success",
  unpaid: "warning",
  refunded: "secondary",
} as const;

export function PortalPaymentBadge({
  status,
  label,
}: {
  status: PortalPaymentStatus | null;
  label: string;
}) {
  if (!status) return <span className="text-muted-foreground">—</span>;
  return <StatusBadge variant={VARIANT[status]}>{label}</StatusBadge>;
}
