import { cn } from '@/lib/utils';

interface CategoryCountBadgeProps {
  count: number;
  active?: boolean;
  /** `solid` = on primary-filled pill; `list` = selected row in dropdown */
  variant?: 'solid' | 'list';
  className?: string;
}

export function CategoryCountBadge({
  count,
  active,
  variant = 'list',
  className,
}: CategoryCountBadgeProps) {
  return (
    <span
      className={cn(
        'inline-flex min-w-[1.25rem] shrink-0 items-center justify-center rounded-full px-1.5 py-px text-[10px] font-mono font-semibold tabular-nums leading-none',
        !active && 'bg-muted text-muted-foreground',
        active &&
          variant === 'solid' &&
          'bg-primary-foreground/20 text-primary-foreground',
        active &&
          variant === 'list' &&
          'border border-primary/30 bg-background text-primary shadow-sm',
        className
      )}
    >
      {count}
    </span>
  );
}
