
import React from 'react';
import { cn } from '@/lib/utils';

const statusStyles = {
  // Quotes
  draft: 'bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300',
  sent: 'bg-blue-100 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300',
  accepted: 'bg-green-100 dark:bg-green-900/20 text-green-700 dark:text-green-300',
  refused: 'bg-red-100 dark:bg-red-900/20 text-red-700 dark:text-red-300',
  expired: 'bg-orange-100 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300',
  
  // Orders & Invoices
  pending: 'bg-yellow-100 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-300',
  validated: 'bg-green-100 dark:bg-green-900/20 text-green-700 dark:text-green-300',
  paid: 'bg-green-100 dark:bg-green-900/20 text-green-700 dark:text-green-300',
  partial: 'bg-orange-100 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300',
  cancelled: 'bg-red-100 dark:bg-red-900/20 text-red-700 dark:text-red-300',
  
  // Tickets
  open: 'bg-blue-100 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300',
  'in-progress': 'bg-purple-100 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300',
  resolved: 'bg-green-100 dark:bg-green-900/20 text-green-700 dark:text-green-300',
  closed: 'bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300',
  
  // Priorities
  low: 'bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300',
  normal: 'bg-blue-100 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300',
  high: 'bg-orange-100 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300',
  critical: 'bg-red-100 dark:bg-red-900/20 text-red-700 dark:text-red-300',
  
  // Opportunities
  new: 'bg-blue-100 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300',
  qualification: 'bg-purple-100 dark:bg-purple-900/20 text-purple-700 dark:text-purple-300',
  proposal: 'bg-yellow-100 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-300',
  negotiation: 'bg-orange-100 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300',
  won: 'bg-green-100 dark:bg-green-900/20 text-green-700 dark:text-green-300',
  lost: 'bg-red-100 dark:bg-red-900/20 text-red-700 dark:text-red-300',
};

const statusLabels = {
  draft: 'Brouillon',
  sent: 'Envoyé',
  accepted: 'Accepté',
  refused: 'Refusé',
  expired: 'Expiré',
  pending: 'En attente',
  validated: 'Validé',
  paid: 'Payé',
  partial: 'Partiel',
  cancelled: 'Annulé',
  open: 'Ouvert',
  'in-progress': 'En cours',
  resolved: 'Résolu',
  closed: 'Fermé',
  low: 'Basse',
  normal: 'Normale',
  high: 'Haute',
  critical: 'Critique',
  new: 'Nouveau',
  qualification: 'Qualification',
  proposal: 'Proposition',
  negotiation: 'Négociation',
  won: 'Gagné',
  lost: 'Perdu',
};

const labels = {
  0: { label: 'Saisi', color: 'bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300' },
  1: { label: 'Confirmé', color: 'bg-yellow-100 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-300' },
  2: { label: 'Accepté', color: 'bg-green-100 text-green-700 border-green-200 dark:bg-green-900/30 dark:text-green-400 dark:border-green-800' },
  3: { label: 'Perdu', color: 'bg-red-100 dark:bg-red-900/20 text-red-700 dark:text-red-300' },
  4: { label: 'Archivé', color: 'bg-orange-100 dark:bg-orange-900/20 text-orange-700 dark:text-orange-300' },
  5: { label: 'Transformé', color: 'bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300' },
}


 const StatusBadge = ({ status }) => {
  const info = labels[status];

  return (
    <span
      className={cn(
        "inline-flex items-center px-2.5 py-0.5 rounded-lg text-xs font-medium",
        info?.color ?? "bg-gray-200 text-gray-700"
      )}
    >
      {info?.label ?? `Statut ${status}`}
    </span>
  );
};


export default StatusBadge

