'use client';

import { type RiskLevel, RISK_LEVEL_LABELS } from '../../../domain/value-objects/risk-level';
import { cn } from '@/lib/utils';

const RISK_LEVEL_STYLES: Record<RiskLevel, string> = {
  0: 'bg-green-100 text-green-800 border-green-200',
  1: 'bg-yellow-100 text-yellow-800 border-yellow-200',
  2: 'bg-orange-100 text-orange-800 border-orange-200',
  3: 'bg-red-100 text-red-800 border-red-200',
};

interface RiskLevelBadgeProps {
  level: RiskLevel;
  className?: string;
}

export function RiskLevelBadge({ level, className }: RiskLevelBadgeProps) {
  return (
    <span
      className={cn(
        'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold',
        RISK_LEVEL_STYLES[level],
        className,
      )}
    >
      {RISK_LEVEL_LABELS[level]}
    </span>
  );
}
