'use client';

import {
  formatCodeAsLabel,
  treatmentTypeBannerStyle,
} from '@/components/shared/treatmentTypeDisplay';

interface TreatmentTypeBadgeProps {
  type: string;
  label?: string;
  className?: string;
}

export function TreatmentTypeBadge({ type, label, className = '' }: TreatmentTypeBadgeProps) {
  const display = label ?? formatCodeAsLabel(type);

  return (
    <span
      className={`inline-flex items-center justify-center box-border rounded-md border min-h-[1.75rem] px-2.5 py-1 text-xs font-medium leading-none shrink-0 ${className}`.trim()}
      style={treatmentTypeBannerStyle(type)}
    >
      {display}
    </span>
  );
}
