// import { apiClient } from '@/lib/axios';
 import { api as apiClient } from "../auth/http";


export interface Train {
  id: string;
  code: string;
  capacityTons: number;
  trainNumber?: string;
  trainName?: string;
  routeId?: string;
  originStationId?: string;
  destinationStationId?: string;
  departureTime?: string;
  arrivalTime?: string;
  locomotiveNumber?: string;
  status: string;
  remarks?: string;
}

export const trainService = {
  getAll: () => apiClient.get<Train[]>('/trains'),
  getById: (id: string) => apiClient.get<Train>(`/trains/${id}`),
  create: (data: Partial<Train>) => apiClient.post('/trains', data),
  update: (id: string, data: Partial<Train>) => apiClient.patch(`/trains/${id}`, data),
  delete: (id: string) => apiClient.delete(`/trains/${id}`),
  getDetails: (id: string) => apiClient .get(`/trains/${id}/details`),
};