import { Box, Typography } from '@mui/material'

interface Props {
  score: number
  size?: 'sm' | 'md' | 'lg'
}

function scoreColor(score: number): string {
  if (score >= 78) return '#1a7a4a'
  if (score >= 52) return '#d97706'
  return '#c0392b'
}

const FONT_SIZES: Record<string, string> = { sm: '1.25rem', md: '1.75rem', lg: '2.5rem' }

export function MatchScoreDisplay({ score, size = 'md' }: Props) {
  return (
    <Box sx={{ display: 'flex', alignItems: 'baseline', gap: 0.25, flexShrink: 0 }}>
      <Typography sx={{ fontWeight: 800, fontSize: FONT_SIZES[size], color: scoreColor(score), lineHeight: 1 }}>
        {score}
      </Typography>
      <Typography variant="caption" color="text.secondary">/100</Typography>
    </Box>
  )
}
