'use client';

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

export function CustomerStatusBadge({ code, label }: { code?: string | null; label: string }) {
  const normalized = code?.toLowerCase() ?? '';
  const variant =
    normalized === 'active'
      ? 'default'
      : normalized === 'inactive' || normalized === 'suspended'
        ? 'outline'
        : 'secondary';
  const Icon =
    normalized === 'active'
      ? Icons.circleCheck
      : normalized === 'inactive' || normalized === 'suspended'
        ? Icons.warning
        : Icons.circle;

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