"use client";

import { cn } from "@/lib/utils";
import {
  type CircuitState,
  stateLabels,
  stateColors,
  stateIcons,
} from "./constants";

interface StateBadgeProps {
  state: CircuitState;
  className?: string;
}

export function StateBadge({ state, className }: StateBadgeProps) {
  const label = stateLabels[state];
  const color = stateColors[state];
  const icon = stateIcons[state];

  return (
    <span
      className={cn(
        "inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded text-xs font-medium",
        color,
        className
      )}
    >
      <span className="text-[10px]">{icon}</span>
      {label}
    </span>
  );
}
