import apiClient from "@/infrastructure/apiClient";
import apiPath from "@/infrastructure/apiPath";
export default {
  async SearchInboundDrivers(keyword = "", pageNumber = 1, pageSize = 10) {
    var searchResult = await apiClient
      .get(
        apiPath.warehouse.searchDrivers +
          "?keyword=" +
          keyword +
          "&pageNumber=" +
          pageNumber +
          "&pageSize=" +
          pageSize
      )
      .then((r) => {
        return r.data;
      })
      .catch((e) => {
        console.log(e);
        return {};
      });
    return searchResult;
  },
  async GetInboundOrders(userId, pageNumber = 1, pageSize = 10) {
    var searchResult = await apiClient
      .get(
        apiPath.warehouse.getInboundOrders +
          "?userId=" +
          userId +
          "&pageNumber=" +
          pageNumber +
          "&pageSize=" +
          pageSize
      )
      .then((r) => {
        return r.data;
      })
      .catch((e) => {
        console.log(e);
        return {};
      });
    return searchResult;
  },
  async Inbound(model) {
    if (model != null) {
      const params = JSON.parse(JSON.stringify(model));
      console.log(params);

      var result = await apiClient
        .post(apiPath.warehouse.inbound, params)
        .then((r) => {
          if (r.data) {
            return r.data;
          }
        })
        .catch((e) => {
          return {};
        });
      return result;
    }
  },
};
