/**
 * API Client para Medios de Transporte de Pedimentos
 */
import { api } from '$lib/api';

export interface PedimentoTransportMeans {
	id: number;
	pedimento_id: number;
	tenant_id: number;
	destination?: number | null;
	entry_exit?: string | null;
	arrival?: string | null;
	departure?: string | null;
	created_at: string;
}

export interface CreatePedimentoTransportMeansData {
	destination?: number | null;
	entry_exit?: string | null;
	arrival?: string | null;
	departure?: string | null;
}

export interface UpdatePedimentoTransportMeansData {
	destination?: number | null;
	entry_exit?: string | null;
	arrival?: string | null;
	departure?: string | null;
}

export const pedimentoTransportApi = {
	get: (pedimentoId: number) =>
		api.get<PedimentoTransportMeans>(`/v1/a76/pedimentos/${pedimentoId}/transport-means/`),

	create: (pedimentoId: number, data: CreatePedimentoTransportMeansData) =>
		api.post<PedimentoTransportMeans>(`/v1/a76/pedimentos/${pedimentoId}/transport-means/`, data),

	update: (pedimentoId: number, data: UpdatePedimentoTransportMeansData) =>
		api.put<PedimentoTransportMeans>(`/v1/a76/pedimentos/${pedimentoId}/transport-means/`, data),

	delete: (pedimentoId: number) =>
		api.delete(`/v1/a76/pedimentos/${pedimentoId}/transport-means/`)
};
