import { Chip } from '@mui/material'
import type { SignalType } from '../../domain/enums'
import { SIGNAL_TYPE_LABELS } from '../../lib/constants'

interface SignalTypeBadgeProps {
  type: SignalType
  size?: 'small' | 'medium'
}

const COLOR_MAP: Record<string, { bg: string; color: string }> = {
  EXPANSION:            { bg: 'rgba(26,122,74,0.12)',  color: '#1a7a4a' },
  POSSIBLE_MOVE_OUT:    { bg: 'rgba(217,119,6,0.12)',  color: '#d97706' },
  CONSTRUCTION_PROJECT: { bg: 'rgba(37,99,235,0.12)',  color: '#1d4ed8' },
  RESTRUCTURING:        { bg: 'rgba(234,88,12,0.12)',  color: '#c2410c' },
  PROJECT_DEVELOPMENT:  { bg: 'rgba(124,58,237,0.12)', color: '#6d28d9' },
  SPACE_CONSOLIDATION:  { bg: 'rgba(100,116,139,0.12)',color: '#475569' },
}

export function SignalTypeBadge({ type, size = 'small' }: SignalTypeBadgeProps) {
  const { bg, color } = COLOR_MAP[type] ?? { bg: '#f1f5f9', color: '#475569' }
  return (
    <Chip
      label={SIGNAL_TYPE_LABELS[type] ?? type}
      size={size}
      sx={{ bgcolor: bg, color, fontWeight: 600, border: 'none' }}
    />
  )
}
