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/appDevicePlanning/serve.ts
const CONFIG = { isPisell2: true };
const getWorkAreas = function() {
	var _ref = require_asyncToGenerator._asyncToGenerator(function* () {
		const response = yield require_index.request.getRequest().get("/tenant/device/workarea", { relation_count: [
			"smartDevices",
			"dumbDevices",
			"integratedDevices"
		] }, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || [];
	});
	return function getWorkAreas() {
		return _ref.apply(this, arguments);
	};
}();
const createWorkArea = function() {
	var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (payload) {
		const response = yield require_index.request.getRequest().post("/tenant/device/workarea", payload, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || null;
	});
	return function createWorkArea(_x) {
		return _ref2.apply(this, arguments);
	};
}();
const updateWorkArea = function() {
	var _ref3 = require_asyncToGenerator._asyncToGenerator(function* (id, payload) {
		const response = yield require_index.request.getRequest().put(`/tenant/device/workarea/${id}`, payload, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || null;
	});
	return function updateWorkArea(_x2, _x3) {
		return _ref3.apply(this, arguments);
	};
}();
const deleteWorkArea = (id) => require_index.request.getRequest().remove(`/tenant/device/workarea/${id}`, {}, CONFIG);
const getWorkAreaDetail = function() {
	var _ref4 = require_asyncToGenerator._asyncToGenerator(function* (params) {
		return require_index.request.getRequest().get(`/tenant/device/workarea`, params, CONFIG);
	});
	return function getWorkAreaDetail(_x4) {
		return _ref4.apply(this, arguments);
	};
}();
const getDevices = function() {
	var _ref5 = require_asyncToGenerator._asyncToGenerator(function* (params) {
		const response = yield require_index.request.getRequest().get("/tenant/device", {
			with: params.with || [
				"type",
				"model",
				"workarea"
			],
			workarea_id: params.workarea_id,
			type_kind: params.type_kind,
			type_code: params.type_code,
			model_code: params.model_code,
			profile_id: params.profile_id
		}, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || [];
	});
	return function getDevices(_x5) {
		return _ref5.apply(this, arguments);
	};
}();
const getDeviceModel = function() {
	var _ref6 = require_asyncToGenerator._asyncToGenerator(function* (code, withFields = [
		"type",
		"brand",
		"activeProfiles"
	]) {
		const response = yield require_index.request.getRequest().get(`/tenant/device/model/${code}`, { with: withFields }, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || null;
	});
	return function getDeviceModel(_x6) {
		return _ref6.apply(this, arguments);
	};
}();
const getDeviceTypes = function() {
	var _ref7 = require_asyncToGenerator._asyncToGenerator(function* (params) {
		const response = yield require_index.request.getRequest().get("/tenant/device/type/all", {
			kind: params.kind,
			with: params.with || ["activeModels", "activeModels.activeProfiles"]
		}, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || [];
	});
	return function getDeviceTypes(_x7) {
		return _ref7.apply(this, arguments);
	};
}();
const createDevice = function() {
	var _ref8 = require_asyncToGenerator._asyncToGenerator(function* (payload) {
		const response = yield require_index.request.getRequest().post("/tenant/device", payload, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || null;
	});
	return function createDevice(_x8) {
		return _ref8.apply(this, arguments);
	};
}();
const updateDevice = function() {
	var _ref9 = require_asyncToGenerator._asyncToGenerator(function* (id, payload) {
		const response = yield require_index.request.getRequest().put(`/tenant/device/${id}`, payload, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || null;
	});
	return function updateDevice(_x9, _x10) {
		return _ref9.apply(this, arguments);
	};
}();
const deleteDevice = (id) => require_index.request.getRequest().remove(`/tenant/device/${id}`, {}, CONFIG);
const linkDevice = function() {
	var _ref10 = require_asyncToGenerator._asyncToGenerator(function* (id, data) {
		const response = yield require_index.request.getRequest().put(`/tenant/device/${id}/link`, { data }, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || null;
	});
	return function linkDevice(_x11, _x12) {
		return _ref10.apply(this, arguments);
	};
}();
const getDeviceSetting = function() {
	var _ref11 = require_asyncToGenerator._asyncToGenerator(function* (id, items) {
		const response = yield require_index.request.getRequest().post(`/tenant/device/${id}/setting`, { items }, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || {};
	});
	return function getDeviceSetting(_x13, _x14) {
		return _ref11.apply(this, arguments);
	};
}();
//#endregion
exports.createDevice = createDevice;
exports.createWorkArea = createWorkArea;
exports.deleteDevice = deleteDevice;
exports.deleteWorkArea = deleteWorkArea;
exports.getDeviceModel = getDeviceModel;
exports.getDeviceSetting = getDeviceSetting;
exports.getDeviceTypes = getDeviceTypes;
exports.getDevices = getDevices;
exports.getWorkAreaDetail = getWorkAreaDetail;
exports.getWorkAreas = getWorkAreas;
exports.linkDevice = linkDevice;
exports.updateDevice = updateDevice;
exports.updateWorkArea = updateWorkArea;
