import { api } from "@/config";
import {
  API_GET_TRIP,
  API_HAUL_HANDLE,
  API_POST_TRIPSLIST,
  API_UPDATE_FISHING_LOGS,
  API_UPDATE_TRIP_STATUS,
  API_GET_LAST_TRIP,
} from "@/constants";

export async function queryTrip() {
  return api.get<Model.Trip>(API_GET_TRIP);
}

export async function queryLastTrip(thingId: string) {
  return api.get<Model.Trip>(`${API_GET_LAST_TRIP}/${thingId}`);
}

export async function queryUpdateTripState(body: Model.TripUpdateStateRequest) {
  return api.put(API_UPDATE_TRIP_STATUS, body);
}

export async function queryStartNewHaul(body: Model.NewFishingLogRequest) {
  return api.put(API_HAUL_HANDLE, body);
}

export async function queryUpdateFishingLogs(body: Model.FishingLog) {
  return api.put(API_UPDATE_FISHING_LOGS, body);
}

export async function queryTripsList(body: Model.TripListBody) {
  return api.post(API_POST_TRIPSLIST, body);
}
