import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import { request } from "../../../../utils/index.js";
import { CONFIG } from "./shared.js";
//#region src/plus/saasDevice/devicePlanning/api/devices.ts
const getDevices = function() {
	var _ref = _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(_x) {
		return _ref.apply(this, arguments);
	};
}();
const getDeviceDetail = function() {
	var _ref2 = _asyncToGenerator(function* (id) {
		const response = yield request.getRequest().get(`/tenant/device/${id}`, { with: [
			"type",
			"model",
			"model.activeProfiles",
			"profile"
		] }, CONFIG);
		return (response === null || response === void 0 ? void 0 : response.data) || null;
	});
	return function getDeviceDetail(_x2) {
		return _ref2.apply(this, arguments);
	};
}();
const createDevice = function() {
	var _ref3 = _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(_x3) {
		return _ref3.apply(this, arguments);
	};
}();
const sortDevices = (ids) => request.getRequest().post("/tenant/device/sort", { ids }, CONFIG);
const updateDevice = function() {
	var _ref4 = _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(_x4, _x5) {
		return _ref4.apply(this, arguments);
	};
}();
const deleteDevice = (id) => request.getRequest().remove(`/tenant/device/${id}`, {}, CONFIG);
//#endregion
export { createDevice, deleteDevice, getDeviceDetail, getDevices, sortDevices, updateDevice };
