import Badge from 'react-bootstrap/Badge';
import { useI18n } from '../i18n/context';

interface ScoreBadgeProps {
  success: boolean;
  score?: number;
}

function ScoreBadge({ success, score }: ScoreBadgeProps) {
  const { t } = useI18n();
  return (
    <Badge bg={success ? 'success' : 'danger'} style={{ fontSize: '1rem', padding: '0.5rem 1rem' }}>
      {score !== undefined && <span className="me-1">{score}</span>}
      {success ? t('badge.success') : t('badge.failed')}
    </Badge>
  );
}

export default ScoreBadge;
