import api from "./api.js";
import { unwrapData, unwrapList } from "./http.js";

export async function listJobTypes(query = {}) {
  const res = await api.get("/ptw_job_type", { params: query });
  return unwrapList(res);
}

export async function getJobType(jobTypeId) {
  const res = await api.get(`/ptw_job_type/${jobTypeId}`);
  return unwrapData(res);
}

export async function createJobType(payload) {
  const res = await api.post("/ptw_job_type", payload);
  return unwrapData(res);
}

export async function updateJobType(jobTypeId, payload) {
  const res = await api.put(`/ptw_job_type/${jobTypeId}`, payload);
  return unwrapData(res);
}
