"use client";

import { cn } from "@/lib/utils";
import { type VerdictType, verdictLabels, verdictColors, verdictIcons } from "./constants";

interface VerdictBadgeProps {
  verdict: VerdictType;
  className?: string;
  size?: "sm" | "xs";
}

export function VerdictBadge({ verdict, className, size = "sm" }: VerdictBadgeProps) {
  const label = verdictLabels[verdict];
  const color = verdictColors[verdict];
  const icon = verdictIcons[verdict];

  const sizeClass = size === "xs" ? "text-[10px] px-1.5 py-0.5" : "text-xs px-2.5 py-0.5";

  return (
    <span
      className={cn(
        "inline-flex items-center gap-1 rounded font-medium",
        color,
        sizeClass,
        className
      )}
    >
      <span className={size === "xs" ? "text-[8px]" : "text-[10px]"}>{icon}</span>
      {label}
    </span>
  );
}
