// Document statuses (Odoo-compatible: draft -> sent -> sale -> done)
export const DOCUMENT_STATUS = {
  DRAFT: 'draft',
  SENT: 'sent',
  SALE: 'sale',  // Orden confirmada (reemplaza 'confirmed' para alinearse con Odoo)
  DONE: 'done',
  CANCELLED: 'cancelled',
} as const;

export type DocumentStatus = (typeof DOCUMENT_STATUS)[keyof typeof DOCUMENT_STATUS];

export const DOCUMENT_STATUS_LABELS: Record<DocumentStatus, string> = {
  [DOCUMENT_STATUS.DRAFT]: 'Borrador',
  [DOCUMENT_STATUS.SENT]: 'Cotización Enviada',
  [DOCUMENT_STATUS.SALE]: 'Orden de Venta',
  [DOCUMENT_STATUS.DONE]: 'Completado',
  [DOCUMENT_STATUS.CANCELLED]: 'Cancelado',
};

export const DOCUMENT_STATUS_COLORS: Record<DocumentStatus, string> = {
  [DOCUMENT_STATUS.DRAFT]: 'bg-gray-100 text-gray-800',
  [DOCUMENT_STATUS.SENT]: 'bg-blue-100 text-blue-800',
  [DOCUMENT_STATUS.SALE]: 'bg-green-100 text-green-800',
  [DOCUMENT_STATUS.DONE]: 'bg-emerald-100 text-emerald-800',
  [DOCUMENT_STATUS.CANCELLED]: 'bg-red-100 text-red-800',
};

// Invoice status
export const INVOICE_STATUS = {
  DRAFT: 'draft',
  POSTED: 'posted',
  PAID: 'paid',
  CANCELLED: 'cancelled',
} as const;

export type InvoiceStatus = (typeof INVOICE_STATUS)[keyof typeof INVOICE_STATUS];

export const INVOICE_STATUS_LABELS: Record<InvoiceStatus, string> = {
  [INVOICE_STATUS.DRAFT]: 'Borrador',
  [INVOICE_STATUS.POSTED]: 'Publicada',
  [INVOICE_STATUS.PAID]: 'Pagada',
  [INVOICE_STATUS.CANCELLED]: 'Cancelada',
};

// Lead status
export const LEAD_STATUS = {
  NEW: 'new',
  CONTACTED: 'contacted',
  QUALIFIED: 'qualified',
  CONVERTED: 'converted',
  LOST: 'lost',
} as const;

export type LeadStatus = (typeof LEAD_STATUS)[keyof typeof LEAD_STATUS];

// Opportunity status
export const OPPORTUNITY_STATUS = {
  OPEN: 'open',
  WON: 'won',
  LOST: 'lost',
} as const;

export type OpportunityStatus = (typeof OPPORTUNITY_STATUS)[keyof typeof OPPORTUNITY_STATUS];

// Leave status
export const LEAVE_STATUS = {
  DRAFT: 'draft',
  SUBMITTED: 'submitted',
  APPROVED: 'approved',
  REJECTED: 'rejected',
  CANCELLED: 'cancelled',
} as const;

export type LeaveStatus = (typeof LEAVE_STATUS)[keyof typeof LEAVE_STATUS];
