"use client";

import { cn } from "@/lib/utils";
import { type AuditResult, resultLabels, resultColors } from "./constants";

interface ResultBadgeProps {
  result: AuditResult;
  className?: string;
}

export function ResultBadge({ result, className }: ResultBadgeProps) {
  const label = resultLabels[result];
  const color = resultColors[result];
  const icon = result === "success" ? "\u2713" : "\u2717"; // ✓ or ✗

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