import ApiService from "@/services/ApiService";

const baseUrl = "inventory/transfer-documents";

export const list = async (params = {}) => {
  const response = await ApiService.get(baseUrl, { params });
  return response.data;
};

export const getById = async (id) => {
  const response = await ApiService.get(`${baseUrl}/${id}`);
  return response.data;
};

export const create = async (payload) => {
  const response = await ApiService.post(baseUrl, payload);
  return response.data;
};

/** Entrada o salida en un paso (folio automático, documento confirmado). */
export const quickTransfer = async (payload) => {
  const response = await ApiService.post("inventory/quick-transfer", payload);
  return response.data;
};

export const update = async (id, payload) => {
  const response = await ApiService.put(`${baseUrl}/${id}`, payload);
  return response.data;
};

export const confirm = async (id) => {
  const response = await ApiService.post(`${baseUrl}/${id}/confirm`);
  return response.data;
};

export const cancelDraft = async (id) => {
  const response = await ApiService.post(`${baseUrl}/${id}/cancel-draft`);
  return response.data;
};
