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/plus/saasTeamMembers/serve.ts
var serve_exports = {};
__export(serve_exports, {
  activateTeamMember: () => activateTeamMember,
  bindRelationRecord: () => bindRelationRecord,
  createTeamMember: () => createTeamMember,
  deactivateTeamMember: () => deactivateTeamMember,
  deleteTeamMember: () => deleteTeamMember,
  getAccountByEmail: () => getAccountByEmail,
  getFormRecords: () => getFormRecords,
  getRelationRecords: () => getRelationRecords,
  getRoles: () => getRoles,
  getTeamMemberDetail: () => getTeamMemberDetail,
  getTeamMembers: () => getTeamMembers,
  unbindRelationRecord: () => unbindRelationRecord,
  updateRelationRecord: () => updateRelationRecord,
  updateTeamMember: () => updateTeamMember
});
module.exports = __toCommonJS(serve_exports);
var import_utils = require("../../utils");
var getTeamMembers = async (params = {}) => {
  const response = await import_utils.request.getRequest().get("/tenant/account", params);
  return response.data || { list: [], count: 0, page: 1, size: 10 };
};
var getTeamMemberDetail = async (id) => {
  const response = await import_utils.request.getRequest().get(`/tenant/account/${id}`, {
    "with[]": ["account", "roles"]
  });
  return response.data;
};
var createTeamMember = async (data) => {
  const response = await import_utils.request.getRequest().post("/tenant/account", data);
  return response.data;
};
var updateTeamMember = async (id, data) => {
  const response = await import_utils.request.getRequest().put(`/tenant/account/${id}`, data);
  return response.data;
};
var deleteTeamMember = async (id) => {
  await import_utils.request.getRequest().remove(`/tenant/account/${id}`);
};
var activateTeamMember = async (id) => {
  return updateTeamMember(id, { status: "active" });
};
var deactivateTeamMember = async (id) => {
  return updateTeamMember(id, { status: "inactive" });
};
var getRoles = async () => {
  const response = await import_utils.request.getRequest().get("/tenant/role", {});
  return response.data || [];
};
var getAccountByEmail = async (params) => {
  const response = await import_utils.request.getRequest().get(`/account:get`, params, {
    isNocobaseReadonly: true,
    headers: {
      "x-data-source": "pisell2"
    }
  });
  return response.data;
};
var shopPrefix = "/shop";
var getFormRecords = async (params) => {
  const { data } = await import_utils.request.getRequest().get(`${shopPrefix}/form/data/v1`, params, {
    isShopApi: true
  });
  return data || {
    list: [],
    count: 0,
    skip: 1,
    size: 10
  };
};
var getRelationRecords = async (params) => {
  const { data } = await import_utils.request.getRequest().get(`${shopPrefix}/form/relation/record/raw`, params, {
    isShopApi: true
  });
  return data || [];
};
var bindRelationRecord = async (params) => {
  const { data } = await import_utils.request.getRequest().post(`${shopPrefix}/form/relation/record`, params, {
    isShopApi: true
  });
  return data;
};
var updateRelationRecord = async (id, params) => {
  const { data } = await import_utils.request.getRequest().put(`${shopPrefix}/form/relation/record/${id}`, params, {
    isShopApi: true
  });
  return data;
};
var unbindRelationRecord = async (id) => {
  await import_utils.request.getRequest().remove(
    `${shopPrefix}/form/relation/record/${id}`,
    {},
    { isShopApi: true }
  );
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  activateTeamMember,
  bindRelationRecord,
  createTeamMember,
  deactivateTeamMember,
  deleteTeamMember,
  getAccountByEmail,
  getFormRecords,
  getRelationRecords,
  getRoles,
  getTeamMemberDetail,
  getTeamMembers,
  unbindRelationRecord,
  updateRelationRecord,
  updateTeamMember
});
