import { Chip } from '@mui/material'
import type { ReviewEntityType } from '../../domain/review'

interface ReviewEntityTypeBadgeProps {
  entityType: ReviewEntityType
  size?: 'small' | 'medium'
}

const CONFIG: Record<ReviewEntityType, { label: string; color: string }> = {
  FUTURE_SIGNAL:        { label: 'Zukunftssignal',   color: '#7c3aed' },
  MATCH_EXPLANATION:    { label: 'Match-Begründung', color: '#1e3a5f' },
  LOW_CONFIDENCE_MATCH: { label: 'Niedr. Konfidenz', color: '#ea580c' },
  CONTACT_RELEASE:      { label: 'Kontaktfreigabe',  color: '#0891b2' },
  AI_OUTPUT:            { label: 'AI-Output',        color: '#4f46e5' },
  PROPERTY_DATA_ISSUE:  { label: 'Datenfehler',      color: '#c0392b' },
}

export function ReviewEntityTypeBadge({ entityType, size = 'small' }: ReviewEntityTypeBadgeProps) {
  const { label, color } = CONFIG[entityType] ?? { label: entityType, color: '#64748b' }
  return (
    <Chip
      size={size}
      label={label}
      sx={{
        bgcolor: `${color}18`,
        color,
        fontWeight: 600,
        fontSize: size === 'small' ? '0.7rem' : '0.8125rem',
      }}
    />
  )
}
