import React from 'react';
import { Badge } from '@/ui/Badge';

interface RatingBadgeProps {
  rating: number;
  size?: 'sm' | 'md' | 'lg';
  className?: string;
}

export function RatingBadge({ rating, size = 'md', className = '' }: RatingBadgeProps) {
  const getColor = (val: number) => {
    if (val >= 2500) return { variant: 'warning' as const };
    if (val >= 2000) return { color: 'text-purple-400', bg: 'bg-purple-400/10', borderColor: 'border-purple-400/20' };
    if (val >= 1500) return { variant: 'primary' as const };
    if (val >= 1000) return { variant: 'success' as const };
    return { variant: 'default' as const };
  };

  const sizeMap: Record<string, 'xs' | 'sm' | 'md'> = {
    sm: 'xs',
    md: 'sm',
    lg: 'md',
  };

  const config = getColor(rating);

  return (
    <Badge 
      {...config}
      size={sizeMap[size]} 
      className={`font-mono ${className}`}
      rounded="sm"
    >
      {rating.toLocaleString()}
    </Badge>
  );
}
