import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import { request } from "../../../utils/index.js";
//#region src/plus/saasDevice/devicePlanning/serve.ts
const CONFIG = { isPisell2: true };
const getWorkAreas = function() {
	var _ref = _asyncToGenerator(function* () {
		const response = yield 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 = _asyncToGenerator(function* (payload) {
		const response = yield 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 = _asyncToGenerator(function* (id, payload) {
		const response = yield 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 sortWorkAreas = (ids) => request.getRequest().post("/tenant/device/workarea/sort", { ids }, CONFIG);
const deleteWorkArea = (id) => request.getRequest().remove(`/tenant/device/workarea/${id}`, {}, CONFIG);
const getWorkAreaDetail = function() {
	var _ref4 = _asyncToGenerator(function* (params) {
		return request.getRequest().get(`/tenant/device/workarea`, params, CONFIG);
	});
	return function getWorkAreaDetail(_x4) {
		return _ref4.apply(this, arguments);
	};
}();
const getDevices = function() {
	var _ref5 = _asyncToGenerator(function* (params) {
		const response = yield request.getRequest().get("/tenant/device", {
			with: params.with || [
				"type",
				"model",
				"workarea"
			],
			workarea_id: params.workarea_id,
			type_kind: params.type_kind,
			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 getDeviceTypes = function() {
	var _ref6 = _asyncToGenerator(function* (params) {
		const response = yield request.getRequest().get("/tenant/device/type/all", {
			with: params.with || ["activeModels", "activeModels.activeProfiles"],
			kind: params.kind
		}, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || [];
	});
	return function getDeviceTypes(_x6) {
		return _ref6.apply(this, arguments);
	};
}();
const createDevice = function() {
	var _ref7 = _asyncToGenerator(function* (payload) {
		const response = yield request.getRequest().post("/tenant/device", payload, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || null;
	});
	return function createDevice(_x7) {
		return _ref7.apply(this, arguments);
	};
}();
const sortDevices = (ids) => request.getRequest().post("/tenant/device/sort", { ids }, CONFIG);
const updateDevice = function() {
	var _ref8 = _asyncToGenerator(function* (id, payload) {
		const response = yield request.getRequest().put(`/tenant/device/${id}`, payload, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || null;
	});
	return function updateDevice(_x8, _x9) {
		return _ref8.apply(this, arguments);
	};
}();
const deleteDevice = (id) => request.getRequest().remove(`/tenant/device/${id}`, {}, CONFIG);
//#endregion
export { createDevice, createWorkArea, deleteDevice, deleteWorkArea, getDeviceTypes, getDevices, getWorkAreaDetail, getWorkAreas, sortDevices, sortWorkAreas, updateDevice, updateWorkArea };
