'use client';

import { Badge } from '@/components/ui/badge';
import { Icons } from '@/components/icons';

export function EnquiryStatusBadge({ code, label }: { code?: string | null; label: string }) {
  const normalized = code?.toLowerCase() ?? '';
  const variant =
    normalized === 'closed_lost' || normalized === 'cancelled'
      ? 'outline'
      : normalized === 'converted'
        ? 'default'
        : normalized === 'follow_up'
          ? 'secondary'
          : 'secondary';
  const Icon =
    normalized === 'converted'
      ? Icons.circleCheck
      : normalized === 'closed_lost' || normalized === 'cancelled'
        ? Icons.warning
        : normalized === 'follow_up'
          ? Icons.clock
          : Icons.circle;

  return (
    <Badge variant={variant} className='capitalize'>
      <Icon className='h-3 w-3' />
      {label}
    </Badge>
  );
}
