// js/components/widgets/freight-note-badges.jsx
// [Wave 14 v223.39 20260520] Extraído de ReceberFrete.jsx L26-40
// Badge status de freight_notes (estados: EM_TRANSITO/EM_RECEBIMENTO/EMITIDA/CONFIRMADA_FRETEIRO/COMPLETA)
//
// DIFERENTE de Wave 13 FreightStatusBadge (estados close_requests: pending/approved/denied/more_info)
// — não unificar, são domain values distintos
(function(){
  'use strict';

  function FreightNoteStatusBadge(props) {
    const { status } = props;
    const map = {
      EM_TRANSITO:         { bg: '#FEF3C7', fg: '#92400E', label: '🚚 Em Trânsito' },
      EM_RECEBIMENTO:      { bg: '#E0F2FE', fg: '#0369A1', label: '📦 Recebendo' },
      EMITIDA:             { bg: '#EFF6FF', fg: '#2563EB', label: 'Emitida' },
      CONFIRMADA_FRETEIRO: { bg: '#FEF9E7', fg: '#B89840', label: 'Confirmada' },
      COMPLETA:            { bg: '#DCFCE7', fg: '#16A34A', label: '✓ Completa' },
    };
    const c = map[status] || { bg: '#F3F4F6', fg: '#374151', label: status };
    return (
      <span style={{ background: c.bg, color: c.fg, padding: '4px 12px', borderRadius: 999, fontSize: 12, fontWeight: 700, display: 'inline-block' }}>
        {c.label}
      </span>
    );
  }

  // Namespace
  window.ZNX = window.ZNX || {};
  window.ZNX.components = window.ZNX.components || {};
  window.ZNX.components.FreightNoteStatusBadge = FreightNoteStatusBadge;
  window.FreightNoteStatusBadge = FreightNoteStatusBadge;
})();
