import { api } from "@/config";
import {
  API_GET_PHOTO,
  API_GET_TRIP_CREW,
  API_SEARCH_CREW,
  API_TRIP_CREW,
} from "@/constants";

export async function queryTripCrew(tripId: string) {
  return api.get<{ trip_crews: Model.TripCrews[] }>(
    `${API_GET_TRIP_CREW}/${tripId}`
  );
}

export async function newTripCrew(body: Model.NewTripCrewAPIRequest) {
  return api.post(API_TRIP_CREW, body);
}

export async function updateTripCrew(body: Model.UpdateTripCrewAPIRequest) {
  return api.put(API_TRIP_CREW, body);
}

export async function deleteTripCrew(tripId: string, personalId: string) {
  return api.delete(`${API_TRIP_CREW}/${tripId}/${personalId}`);
}
