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

const STATUS = {
  einsatzbereit: {
    label: "einsatzbereit",
    cls: "bg-bereit/10 text-bereit border-bereit/30",
  },
  wartung: { label: "Wartung", cls: "bg-wartung/10 text-wartung border-wartung/30" },
  ausser_dienst: {
    label: "außer Dienst",
    cls: "bg-anthrazit/10 text-anthrazit border-anthrazit/30",
  },
} as const;

export type StatusKey = keyof typeof STATUS;

export function StatusBadge({ status }: { status: StatusKey }) {
  const s = STATUS[status];
  return (
    <span
      className={cn(
        "inline-flex items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium tabular-nums",
        s.cls,
      )}
    >
      <span className="h-1.5 w-1.5 rounded-full bg-current" aria-hidden />
      {s.label}
    </span>
  );
}

export function Badge({
  children,
  className,
}: {
  children: React.ReactNode;
  className?: string;
}) {
  return (
    <span
      className={cn(
        "inline-flex items-center rounded-sm border border-rand bg-nebel px-2 py-0.5 text-xs font-medium text-anthrazit",
        className,
      )}
    >
      {children}
    </span>
  );
}
