const STATUS_CONFIG: Record<string, { bg: string; text: string; label: string }> = {
  COMPLETED: { bg: 'bg-emerald-100 text-emerald-700', text: '완료', label: '✓' },
  FAILED: { bg: 'bg-red-100 text-red-700', text: '실패', label: '✕' },
  STARTED: { bg: 'bg-blue-100 text-blue-700', text: '실행중', label: '↻' },
  STARTING: { bg: 'bg-cyan-100 text-cyan-700', text: '시작중', label: '⏳' },
  STOPPED: { bg: 'bg-amber-100 text-amber-700', text: '중지됨', label: '⏸' },
  STOPPING: { bg: 'bg-orange-100 text-orange-700', text: '중지중', label: '⏸' },
  ABANDONED: { bg: 'bg-gray-100 text-gray-700', text: '포기됨', label: '—' },
  SCHEDULED: { bg: 'bg-violet-100 text-violet-700', text: '예정', label: '🕐' },
  UNKNOWN: { bg: 'bg-gray-100 text-gray-500', text: '알수없음', label: '?' },
};

interface Props {
  status: string;
  className?: string;
}

export default function StatusBadge({ status, className = '' }: Props) {
  const config = STATUS_CONFIG[status] || STATUS_CONFIG.UNKNOWN;
  return (
    <span className={`inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-semibold ${config.bg} ${className}`}>
      <span>{config.label}</span>
      {config.text}
    </span>
  );
}

// eslint-disable-next-line react-refresh/only-export-components
export function getStatusColor(status: string): string {
  switch (status) {
    case 'COMPLETED': return '#10b981';
    case 'FAILED': return '#ef4444';
    case 'STARTED': return '#3b82f6';
    case 'STARTING': return '#06b6d4';
    case 'STOPPED': return '#f59e0b';
    case 'STOPPING': return '#f97316';
    case 'SCHEDULED': return '#8b5cf6';
    default: return '#6b7280';
  }
}
