import { cn } from "@minmon/ui/lib/utils";
import { cva, type VariantProps } from "class-variance-authority";
import * as React from "react";

const statusBadgeVariants = cva(
  "inline-flex items-center gap-1 border px-2 py-0.5 text-[11px] font-medium uppercase tracking-[0.16em]",
  {
    variants: {
      variant: {
        neutral: "border-border bg-muted/40 text-muted-foreground",
        success: "border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
        warning: "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-400",
        destructive: "border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-400",
        info: "border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-400",
      },
    },
    defaultVariants: {
      variant: "neutral",
    },
  },
);

function StatusBadge({
  className,
  variant,
  ...props
}: React.ComponentProps<"span"> & VariantProps<typeof statusBadgeVariants>) {
  return <span className={cn(statusBadgeVariants({ variant }), className)} {...props} />;
}

export { StatusBadge, statusBadgeVariants };
