'use client';

import { Badge } from '@/components/ui/shared/Badge';
import {
  dueDateBadgeVariantFromIso,
  formatLabCaseDueDate,
} from '@/components/lab/labCaseDueDateDisplay';

interface LabCaseDueDateBadgeProps {
  dueDate: string | null | undefined;
  locale: string;
  className?: string;
}

export function LabCaseDueDateBadge({ dueDate, locale, className }: LabCaseDueDateBadgeProps) {
  const label = formatLabCaseDueDate(dueDate, locale);
  if (!label) return null;

  return (
    <Badge
      variant={dueDateBadgeVariantFromIso(dueDate)}
      fixedWidth={false}
      className={className}
      title={label}
    >
      {label}
    </Badge>
  );
}
