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

interface ReviewPriorityBadgeProps {
  priority: ReviewPriority
  size?: 'small' | 'medium'
}

const CONFIG: Record<ReviewPriority, { label: string; color: string }> = {
  LOW:      { label: 'Niedrig',  color: '#64748b' },
  MEDIUM:   { label: 'Mittel',   color: '#d97706' },
  HIGH:     { label: 'Hoch',     color: '#ea580c' },
  CRITICAL: { label: 'Kritisch', color: '#c0392b' },
}

export function ReviewPriorityBadge({ priority, size = 'small' }: ReviewPriorityBadgeProps) {
  const { label, color } = CONFIG[priority] ?? CONFIG.MEDIUM
  return (
    <Chip
      size={size}
      label={label}
      sx={{
        bgcolor: `${color}18`,
        color,
        fontWeight: 700,
        fontSize: size === 'small' ? '0.7rem' : '0.8125rem',
        border: `1px solid ${color}40`,
      }}
    />
  )
}
