import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import { request } from "../../utils/index.js";
//#region src/plus/saasTeamMembers/serve.ts
/**
* 获取团队成员列表
* GET: /tenant/account
*/
const getTeamMembers = function() {
	var _ref = _asyncToGenerator(function* (params = {}) {
		return (yield request.getRequest().get("/tenant/account", params)).data || {
			list: [],
			count: 0,
			page: 1,
			size: 10
		};
	});
	return function getTeamMembers() {
		return _ref.apply(this, arguments);
	};
}();
(function() {
	var _ref2 = _asyncToGenerator(function* (id) {
		return (yield request.getRequest().get(`/tenant/account/${id}`, { "with[]": ["account", "roles"] })).data;
	});
	return function getTeamMemberDetail(_x) {
		return _ref2.apply(this, arguments);
	};
})();
/**
* 创建团队成员
* POST: /tenant/account
*/
const createTeamMember = function() {
	var _ref3 = _asyncToGenerator(function* (data) {
		return (yield request.getRequest().post("/tenant/account", data)).data;
	});
	return function createTeamMember(_x2) {
		return _ref3.apply(this, arguments);
	};
}();
/**
* 更新团队成员
* PUT: /tenant/account/{id}
*/
const updateTeamMember = function() {
	var _ref4 = _asyncToGenerator(function* (id, data) {
		return (yield request.getRequest().put(`/tenant/account/${id}`, data)).data;
	});
	return function updateTeamMember(_x3, _x4) {
		return _ref4.apply(this, arguments);
	};
}();
/**
* 删除团队成员
* DELETE: /tenant/account/{id}
*/
const deleteTeamMember = function() {
	var _ref5 = _asyncToGenerator(function* (id) {
		yield request.getRequest().remove(`/tenant/account/${id}`);
	});
	return function deleteTeamMember(_x5) {
		return _ref5.apply(this, arguments);
	};
}();
/**
* 激活团队成员
* PUT: /tenant/account/{id}
*/
const activateTeamMember = function() {
	var _ref6 = _asyncToGenerator(function* (id) {
		return updateTeamMember(id, { status: "active" });
	});
	return function activateTeamMember(_x6) {
		return _ref6.apply(this, arguments);
	};
}();
/**
* 停用团队成员
* PUT: /tenant/account/{id}
*/
const deactivateTeamMember = function() {
	var _ref7 = _asyncToGenerator(function* (id) {
		return updateTeamMember(id, { status: "inactive" });
	});
	return function deactivateTeamMember(_x7) {
		return _ref7.apply(this, arguments);
	};
}();
/**
* 获取所有角色列表（用于筛选和表单选择）
* GET: /tenant/role
*/
const getRoles = function() {
	var _ref8 = _asyncToGenerator(function* () {
		return (yield request.getRequest().get("/tenant/role", {})).data || [];
	});
	return function getRoles() {
		return _ref8.apply(this, arguments);
	};
}();
/**
* 通过email查询账号
* GET: /account:get
* @param params.filter - filter string, e.g. {"email":"test@example.com","tenant_id":1}
*/
const getAccountByEmail = function() {
	var _ref9 = _asyncToGenerator(function* (params) {
		return (yield request.getRequest().get(`/account:get`, params, {
			isNocobaseReadonly: true,
			headers: { "x-data-source": "pisell2" }
		})).data;
	});
	return function getAccountByEmail(_x8) {
		return _ref9.apply(this, arguments);
	};
}();
/**
* 查询绑定记录
*/
const shopPrefix = "/shop";
const getFormRecords = function() {
	var _ref10 = _asyncToGenerator(function* (params) {
		const { data } = yield request.getRequest().get(`${shopPrefix}/form/data/v1`, params, { isShopApi: true });
		return data || {
			list: [],
			count: 0,
			skip: 1,
			size: 10
		};
	});
	return function getFormRecords(_x9) {
		return _ref10.apply(this, arguments);
	};
}();
const getRelationRecords = function() {
	var _ref11 = _asyncToGenerator(function* (params) {
		const { data } = yield request.getRequest().get(`${shopPrefix}/form/relation/record/raw`, params, { isShopApi: true });
		return data || [];
	});
	return function getRelationRecords(_x10) {
		return _ref11.apply(this, arguments);
	};
}();
const bindRelationRecord = function() {
	var _ref12 = _asyncToGenerator(function* (params) {
		const { data } = yield request.getRequest().post(`${shopPrefix}/form/relation/record`, params, { isShopApi: true });
		return data;
	});
	return function bindRelationRecord(_x11) {
		return _ref12.apply(this, arguments);
	};
}();
const updateRelationRecord = function() {
	var _ref13 = _asyncToGenerator(function* (id, params) {
		const { data } = yield request.getRequest().put(`${shopPrefix}/form/relation/record/${id}`, params, { isShopApi: true });
		return data;
	});
	return function updateRelationRecord(_x12, _x13) {
		return _ref13.apply(this, arguments);
	};
}();
const unbindRelationRecord = function() {
	var _ref14 = _asyncToGenerator(function* (id) {
		yield request.getRequest().remove(`${shopPrefix}/form/relation/record/${id}`, {}, { isShopApi: true });
	});
	return function unbindRelationRecord(_x14) {
		return _ref14.apply(this, arguments);
	};
}();
//#endregion
export { activateTeamMember, bindRelationRecord, createTeamMember, deactivateTeamMember, deleteTeamMember, getAccountByEmail, getFormRecords, getRelationRecords, getRoles, getTeamMembers, unbindRelationRecord, updateRelationRecord, updateTeamMember };
