import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import { request } from "../../utils/index.js";
//#region src/plus/webPosLogin/service.ts
const _excluded = ["deviceNumber"];
/**
* 获取设备列表
* @param params 查询参数
* @returns Promise<{list: any[], count: number}> 设备列表和总数
*/
const getDeviceList = function() {
	var _ref = _asyncToGenerator(function* (parmas) {
		try {
			const { data } = yield request.getRequest().get(`/shop/device/select`, parmas, { cache: {
				mode: "remote_local",
				type: "indexDB"
			} });
			return data || [];
		} catch (error) {
			console.error(error);
			return [];
		}
	});
	return function getDeviceList(_x) {
		return _ref.apply(this, arguments);
	};
}();
(function() {
	var _ref2 = _asyncToGenerator(function* (shopId) {
		const { data } = yield request.getRequest().get(`/shop/account/choose-shop/${shopId}`, {}, { cache: {
			mode: "remote_local",
			type: "indexDB"
		} });
		return data;
	});
	return function selectShop(_x2) {
		return _ref2.apply(this, arguments);
	};
})();
/**
* 获取租户详情
* @param deviceId 设备ID
* @returns Promise<any> 租户详情
*/
const getTenantDetail = function() {
	var _ref3 = _asyncToGenerator(function* () {
		const { data } = yield request.getRequest().get(`/tenant/core`, {}, {
			cache: {
				mode: "remote_local",
				type: "indexDB"
			},
			prefix: false
		});
		return data;
	});
	return function getTenantDetail() {
		return _ref3.apply(this, arguments);
	};
}();
/**
* 获取租户列表
* @returns Promise<any> 租户列表
*/
const getTenant = function() {
	var _ref4 = _asyncToGenerator(function* () {
		const { data } = yield request.getRequest().get(`/account/auth/tenant`, {}, {
			cache: {
				mode: "remote_local",
				type: "indexDB"
			},
			prefix: false,
			isDefaultSaasDomain: true
		});
		return data;
	});
	return function getTenant() {
		return _ref4.apply(this, arguments);
	};
}();
/**
* 选择设备
* @param deviceNumber 设备编号
* @returns Promise<any> 设备详情
*/
const selectDevice = function() {
	var _ref5 = _asyncToGenerator(function* (params) {
		const { deviceNumber } = params, rest = _objectWithoutProperties(params, _excluded);
		const { data } = yield request.getRequest().post(`/shop/device/${deviceNumber}/allocate`, rest, { cache: {
			mode: "remote_local",
			type: "indexDB"
		} });
		return data;
	});
	return function selectDevice(_x3) {
		return _ref5.apply(this, arguments);
	};
}();
/**
* 解除设备绑定
* @param deviceNumber 设备编号
* @returns Promise<any> 解除设备绑定结果
*/
const dissociateDevice = function() {
	var _ref6 = _asyncToGenerator(function* (params) {
		const { number, dissociateDeviceNumber } = params;
		const { data } = yield request.getRequest().post(`/shop/device/${dissociateDeviceNumber}/deactivate`, { number }, { cache: {
			mode: "remote_local",
			type: "indexDB"
		} });
		return data;
	});
	return function dissociateDevice(_x4) {
		return _ref6.apply(this, arguments);
	};
}();
//#endregion
export { dissociateDevice, getDeviceList, getTenant, getTenantDetail, selectDevice };
