import {
  API_GET_FISH,
  API_GET_TRIP,
  API_HAUL_HANDLE,
  API_UPDATE_FISHING_LOGS,
  API_UPDATE_TRIP_STATUS,
} from '@/constants';
import { request } from '@umijs/max';

export async function getTrip(): Promise<API.Trip> {
  return request<API.Trip>(API_GET_TRIP);
}

export async function updateTripState(body: API.TripUpdateStateRequest) {
  return request(API_UPDATE_TRIP_STATUS, {
    method: 'PUT',
    data: body,
  });
}

export async function startNewHaul(body: API.NewFishingLogRequest) {
  return request(API_HAUL_HANDLE, {
    method: 'PUT',
    data: body,
  });
}

export async function getFishSpecies() {
  return request<API.FishSpeciesResponse[]>(API_GET_FISH);
}

export async function updateFishingLogs(body: API.FishingLog) {
  return request(API_UPDATE_FISHING_LOGS, {
    method: 'PUT',
    data: body,
  });
}
