var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/ruleSetting/server.ts
var server_exports = {};
__export(server_exports, {
  getOrderTypes: () => getOrderTypes,
  getPaymentTypes: () => getPaymentTypes,
  getProductChannel: () => getProductChannel,
  getStaffList: () => getStaffList
});
module.exports = __toCommonJS(server_exports);
var import_utils = require("@pisell/utils");
var import_utils2 = require("../../utils/index");
var getStaffList = async () => {
  let { data } = await import_utils2.request.getRequest().get(
    "/shop/shop/setting/staff",
    {},
    {
      useCache: true,
      fullResult: true
    }
  );
  let _list = ((data == null ? void 0 : data.staff) || []).map((d) => {
    let label = `${d.first_name} ${d.last_name}`;
    if (label.trim() === "") {
      label = d.email;
    }
    return {
      ...d,
      label,
      value: d.account_id
    };
  });
  _list.unshift({
    label: import_utils.locales.getText("pisell2.text.all"),
    value: "all"
  });
  return _list;
};
var getProductChannel = async () => {
  const { data } = await import_utils2.request.getRequest().get("/shop/order/platform-list", {}, { fullResult: true });
  let _list = (data || []).map((d) => {
    return {
      label: d.name,
      value: d.platform
    };
  });
  _list.unshift({
    label: import_utils.locales.getText("pisell2.text.all"),
    value: "all"
  });
  return _list;
};
var getOrderTypes = async () => {
  var _a;
  let { data } = await import_utils2.request.getRequest().get("/shop/order/aggregation-type", {}, { fullResult: true });
  let _list = (_a = data || []) == null ? void 0 : _a.map((d) => {
    return {
      ...d,
      label: d.name,
      value: d.type
    };
  });
  _list.unshift({
    label: import_utils.locales.getText("pisell2.text.all"),
    value: "all"
  });
  return _list;
};
var getPaymentTypes = async () => {
  var _a;
  let { data } = await import_utils2.request.getRequest().get("/shop/till/opened-payment-method", {}, { fullResult: true });
  let _list = (_a = data || []) == null ? void 0 : _a.map((d) => {
    return {
      ...d,
      label: d.name,
      value: d.code
    };
  });
  _list.unshift({
    label: import_utils.locales.getText("pisell2.text.all"),
    value: "all"
  });
  return _list;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  getOrderTypes,
  getPaymentTypes,
  getProductChannel,
  getStaffList
});
