import { Badge } from "@/components/ui/badge";
import type { ServerStatus } from "@/types";
import { cn } from "@/lib/utils";

const STYLES: Record<ServerStatus, string> = {
  online: "bg-success/15 text-success border-success/30",
  offline: "bg-destructive/15 text-destructive border-destructive/30",
  maintenance: "bg-warning/15 text-warning border-warning/30",
  restarting: "bg-info/15 text-info border-info/30",
  full: "bg-primary/15 text-secondary border-primary/30",
};
const LABELS: Record<ServerStatus, string> = {
  online: "Online",
  offline: "Offline",
  maintenance: "Maintenance",
  restarting: "Restarting",
  full: "Full",
};

export function ServerStatusBadge({ status }: { status: ServerStatus }) {
  return (
    <Badge variant="outline" className={cn("gap-1.5 font-medium", STYLES[status])}>
      <span className={cn("h-1.5 w-1.5 rounded-full", status === "online" ? "bg-success animate-pulse" : status === "offline" ? "bg-destructive" : "bg-current")} />
      {LABELS[status]}
    </Badge>
  );
}
