import { Chip } from '@mui/material'
import { ShieldCheck, Building2, Sparkles } from 'lucide-react'
import type { ResultType } from '../../domain/enums'
import { DS_COLORS } from '../../lib/ds'
import { RESULT_TYPE_LABELS } from '../../lib/constants'

interface ResultTypeBadgeProps {
  type: ResultType
  size?: 'small' | 'medium'
}

const ICONS: Record<ResultType, React.ElementType> = {
  VERIFIED_PORTFOLIO:  ShieldCheck,
  MAISON_WORK:         Building2,
  FUTURE_AVAILABILITY: Sparkles,
}

export function ResultTypeBadge({ type, size = 'small' }: ResultTypeBadgeProps) {
  const { bg, fg } = DS_COLORS.resultType[type]
  const Icon = ICONS[type]
  return (
    <Chip
      size={size}
      label={RESULT_TYPE_LABELS[type] ?? type}
      icon={<Icon size={11} color={fg} />}
      aria-label={RESULT_TYPE_LABELS[type] ?? type}
      sx={{
        bgcolor: bg,
        color: fg,
        border: 'none',
        fontWeight: 600,
        fontSize: '0.7rem',
        '& .MuiChip-icon': { ml: 0.5 },
      }}
    />
  )
}
