const require_objectSpread2 = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_asyncToGenerator = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
const require_index = require("../../../utils/index.js");
//#region src/plus/saasDevice/deviceProfile/serve.ts
const CONFIG = { isPisell2: true };
/**
* 获取设备类型列表
* GET: /tenant/device/type/all
*
* - 不传 params：返回左侧菜单使用的全量设备类型数组
* - 传入 code + with：返回指定设备类型详情（含 active_models 等扩展字段）
*/
const getDeviceTypes = function() {
	var _ref = require_asyncToGenerator._asyncToGenerator(function* (params = {}) {
		const response = yield require_index.request.getRequest().get("/tenant/device/type/all", params, CONFIG);
		console.log("xue_>>>>>getDeviceTypes response", response);
		return (response === null || response === void 0 ? void 0 : response.data) || [];
	});
	return function getDeviceTypes() {
		return _ref.apply(this, arguments);
	};
}();
/**
* 设备配置列表
* GET: /tenant/device/profile
*/
const getDeviceProfiles = function() {
	var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (params) {
		const response = yield require_index.request.getRequest().get("/tenant/device/profile", params, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || {
			list: [],
			count: 0,
			page: params.page,
			size: params.size
		};
	});
	return function getDeviceProfiles(_x) {
		return _ref2.apply(this, arguments);
	};
}();
/**
* 创建设备配置
* POST: /tenant/device/profile
*/
const createDeviceProfile = function() {
	var _ref3 = require_asyncToGenerator._asyncToGenerator(function* (payload) {
		const response = yield require_index.request.getRequest().post("/tenant/device/profile", payload, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || null;
	});
	return function createDeviceProfile(_x2) {
		return _ref3.apply(this, arguments);
	};
}();
/**
* 更新设备配置
* PUT: /tenant/device/profile/{id}
*/
const updateDeviceProfile = (id, body) => require_index.request.getRequest().put(`/tenant/device/profile/${id}`, body, CONFIG);
/**
* 关联设备检查（用于删除前判断 Profile 是否被设备占用）
* GET: /tenant/device
* 仅传 profile_id / type_kind / with=['workarea']，不传 workarea_id
*/
const getProfileLinkedDevices = function() {
	var _ref4 = require_asyncToGenerator._asyncToGenerator(function* (params) {
		const response = yield require_index.request.getRequest().get("/tenant/device", require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, params), {}, { with: params.with || ["workarea"] }), CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || [];
	});
	return function getProfileLinkedDevices(_x3) {
		return _ref4.apply(this, arguments);
	};
}();
/**
* 删除设备配置
* DELETE: /tenant/device/profile/{id}
*/
const deleteDeviceProfile = (id) => require_index.request.getRequest().remove(`/tenant/device/profile/${id}`, CONFIG);
//#endregion
exports.createDeviceProfile = createDeviceProfile;
exports.deleteDeviceProfile = deleteDeviceProfile;
exports.getDeviceProfiles = getDeviceProfiles;
exports.getDeviceTypes = getDeviceTypes;
exports.getProfileLinkedDevices = getProfileLinkedDevices;
exports.updateDeviceProfile = updateDeviceProfile;
