import { Badge } from '@/ui/Badge';
import { Heading } from '@/ui/Heading';
import { Icon } from '@/ui/Icon';
import { Stack } from '@/ui/Stack';
import { Text } from '@/ui/Text';
import { ChevronRight, LucideIcon, UserPlus } from 'lucide-react';

interface SkillLevelHeaderProps {
  label: string;
  icon: LucideIcon;
  bgColor: string;
  borderColor: string;
  color: string;
  description: string;
  teamCount: number;
  recruitingCount: number;
  isExpanded: boolean;
  onToggle: () => void;
  showToggle: boolean;
}

export function SkillLevelHeader({
  label,
  icon,
  bgColor,
  borderColor,
  color,
  description,
  teamCount,
  recruitingCount,
  isExpanded,
  onToggle,
  showToggle,
}: SkillLevelHeaderProps) {
  return (
    <Stack display="flex" alignItems="center" justifyContent="between" mb={4}>
      <Stack direction="row" align="center" gap={3}>
        <Stack 
          display="flex" 
          center 
          width="11" 
          height="11" 
          rounded="xl" 
          className={`${bgColor} border ${borderColor}`}
        >
          <Icon icon={icon} size={5} className={color} />
        </Stack>
        <Stack>
          <Stack direction="row" align="center" gap={2}>
            <Heading level={2}>{label}</Heading>
            <Badge variant="default">
              {teamCount} {teamCount === 1 ? 'team' : 'teams'}
            </Badge>
            {recruitingCount > 0 && (
              <Badge variant="success" icon={UserPlus}>
                {recruitingCount} recruiting
              </Badge>
            )}
          </Stack>
          <Text size="sm" color="text-gray-500">{description}</Text>
        </Stack>
      </Stack>

      {showToggle && (
        <Stack
          as="button"
          type="button"
          onClick={onToggle}
          display="flex"
          alignItems="center"
          gap={1}
          px={3}
          py={1.5}
          rounded="lg"
          className="text-sm text-gray-400 hover:text-white hover:bg-iron-gray/50 transition-all"
        >
          <Text size="sm">{isExpanded ? 'Show less' : `View all ${teamCount}`}</Text>
          <Icon icon={ChevronRight} size={4} className={`transition-transform ${isExpanded ? 'rotate-90' : ''}`} />
        </Stack>
      )}
    </Stack>
  );
}
