import { apiClient } from './apiClient';

export const fleetApi = {
  createStation: async (stationData: any, token: string) => {
    return apiClient.post('/v1/fleet/stations', stationData, { token });
  },

  getStations: async (token: string, organisationId?: string) => {
    const url = organisationId 
      ? `/v1/fleet/stations?organisationId=${organisationId}`
      : `/v1/fleet/stations`;
      
    return apiClient.get(url, { token });
  },

  createVehicle: async (vehicleData: any, token: string) => {
    return apiClient.post('/v1/fleet/vehicles', vehicleData, { token });
  },

  getVehicles: async (token: string, orgId: string) => {
    return apiClient.get(`/v1/fleet/vehicles?org_id=${orgId}`, { token });
  },

  updateVehicleDetails: async (vehicleId: string, vehicleData: any, token: string) => {
    return apiClient.patch(`/v1/fleet/vehicles/${vehicleId}`, vehicleData, { token });
  },

  createStaff: async (staffData: any, token: string) => {
    return apiClient.post('/v1/fleet/staff', staffData, { token });
  },

  getStaff: async (token: string, orgId: string) => {
    return apiClient.get(`/v1/fleet/staff?organisationId=${orgId}`, { token });
  },

  createRoster: async (rosterData: any, token: string) => {
    return apiClient.post('/v1/fleet/roster', rosterData, { token });
  },

  startShift: async (shiftData: any, token: string) => {
    return apiClient.post('/v1/fleet/shifts/start', shiftData, { token });
  },

  getInventoryMaster: async (token: string) => {
    return apiClient.get('/v1/fleet/inventory/master', { token });
  }
};
