import { type RefundAllocation, type RefundDestinationOption } from './refund'; /** Estado físico de lo que regresa. */ export type ReturnCondition = 'sellable' | 'defective'; /** A dónde va la mercancía: stock vendible, merma o garantía (reclamo al proveedor). */ export type ReturnStockDestination = 'stock' | 'scrap' | 'warranty'; export declare const RETURN_CONDITION_DESTINATIONS: Record; /** Destino por defecto de una condición (vendible → stock, defectuoso → merma). */ export declare function defaultStockDestination(condition: ReturnCondition): ReturnStockDestination; /** Renglón devolvible: lo vendido menos lo ya devuelto. */ export interface ReturnableLine { key: string; product_id?: string; description: string; sold: number; alreadyReturned?: number; /** Precio unitario neto de descuento tal como se vendió (congelado). */ unit_price: number; /** Fracción (0.16). */ tax_rate?: number; } export interface ReturnLineChoice { quantity: number; condition: ReturnCondition; destination: ReturnStockDestination; } export type ReturnChoices = Record; export declare function returnableQty(l: ReturnableLine): number; export interface ReturnTotals { base: number; tax: number; total: number; goodsLines: number; } export declare function computeReturnTotals(lines: ReturnableLine[], choices: ReturnChoices): ReturnTotals; /** * Relación SAT (c_TipoRelacion) de la NC: 03 «devolución de mercancía» si regresan * renglones con producto; 01 «nota de crédito de los documentos relacionados» si es * solo ajuste de importe. Misma regla que aplica el backend al proyectar la NC. */ export declare function creditNoteRelation(lines: ReturnableLine[], choices: ReturnChoices): '01' | '03'; export interface ReturnValidation { errors: Record; form?: string; valid: boolean; } export declare function validateReturnChoices(lines: ReturnableLine[], choices: ReturnChoices, reason?: string, requireReason?: boolean): ReturnValidation; /** Pasos visibles. Sin almacén, «Recibir» es un paso del mismo asistente (PIT-021). */ export type ReturnStep = 'lines' | 'condition' | 'receive' | 'refund'; export declare function returnSteps(opts: { warehouseConnected: boolean; }): ReturnStep[]; export interface ReturnSubmitPayload { reason: string; notes?: string; /** true cuando el asistente confirmó la recepción (sin almacén). */ received: boolean; lines: { key: string; product_id?: string; quantity: number; condition: ReturnCondition; destination: ReturnStockDestination; }[]; refund: RefundAllocation[]; /** Presente solo si el reembolso incluye una NC CFDI. */ credit_note?: { relation: '01' | '03'; }; totals: ReturnTotals; } /** Única puerta de salida hacia el backend: solo renglones con cantidad > 0. */ export declare function serializeReturn(args: { lines: ReturnableLine[]; choices: ReturnChoices; reason: string; notes?: string; received: boolean; refund: RefundAllocation[]; }): ReturnSubmitPayload; /** Valida el paso de reembolso contra el total de la devolución. */ export declare function validateReturnRefund(total: number, refund: RefundAllocation[], options?: RefundDestinationOption[]): import("./refund").RefundValidation; export type RmaState = 'draft' | 'authorized' | 'received' | 'settled' | 'closed' | 'rejected' | 'cancelled'; export declare const RMA_TRANSITIONS: Record; /** Estados a los que se llega con motivo obligatorio. */ export declare const RMA_REASON_REQUIRED: RmaState[]; export declare function canTransitionRma(from: RmaState, to: RmaState, reason?: string): { ok: boolean; error?: string; }; //# sourceMappingURL=return.d.ts.map