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

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

const CONFIG: Record<string, { bg: string; color: string; Icon: React.ElementType }> = {
  VERIFIED_PORTFOLIO:  { bg: 'rgba(30,58,95,0.1)',   color: '#152642', Icon: ShieldCheck },
  MAISON_WORK:         { bg: 'rgba(3,105,161,0.1)',  color: '#0369a1', Icon: Building2 },
  FUTURE_AVAILABILITY: { bg: 'rgba(124,58,237,0.1)', color: '#6d28d9', Icon: Sparkles },
}

export function SourceTypeBadge({ type, size = 'small' }: SourceTypeBadgeProps) {
  const { bg, color, Icon } = CONFIG[type] ?? { bg: '#f1f5f9', color: '#475569', Icon: Globe }
  return (
    <Chip
      icon={<Icon size={11} color={color} />}
      label={RESULT_TYPE_LABELS[type] ?? type}
      size={size}
      sx={{ bgcolor: bg, color, fontWeight: 600, border: 'none', '& .MuiChip-icon': { ml: 0.5 } }}
    />
  )
}
