// import { apiClient } from '@/lib/axios'; import { api as apiClient } from "../auth/http"; export interface Cargo { id: string; cargoReference: string; shipmentId: string; containerId: string; cargoTypeId?: string; description?: string; quantity: number; weight: number; volume?: number; status: 'PENDING' | 'LOADED' | 'IN_TRANSIT' | 'DELIVERED' | 'UNLOADED'; loadedAt?: string; unloadedAt?: string; } export const cargoService = { getAll: () => apiClient.get('/cargoes'), getById: (id: string) => apiClient.get(`/cargoes/${id}`), getByContainer: (containerId: string) => apiClient.get(`/cargoes?containerId=${containerId}`), create: (data: Partial) => apiClient.post('/cargoes', data), update: (id: string, data: Partial) => apiClient.patch(`/cargoes/${id}`, data), delete: (id: string) => apiClient.delete(`/cargoes/${id}`), load: (cargoId: string, quantity: number, weight: number, volume?: number) => apiClient.post(`/cargoes/${cargoId}/load`, { quantity, weight, volume }), deliver: (cargoId: string) => apiClient.post(`/cargoes/${cargoId}/deliver`), unload: (cargoId: string) => apiClient.post(`/cargoes/${cargoId}/unload`), };