import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import { request } from "../../utils/index.js";
import { locales } from "@pisell/utils";
//#region src/components/ruleSetting/server.ts
const getStaffList = function() {
	var _ref = _asyncToGenerator(function* () {
		let { data } = yield request.getRequest().get("/shop/shop/setting/staff", {}, {
			useCache: true,
			fullResult: true
		});
		console.log("getStaffList", data);
		let _list = ((data === null || data === void 0 ? void 0 : data.staff) || []).map((d) => {
			let label = `${d.first_name} ${d.last_name}`;
			if (label.trim() === "") label = d.email;
			return _objectSpread2(_objectSpread2({}, d), {}, {
				label,
				value: d.account_id
			});
		});
		_list.unshift({
			label: locales.getText("pisell2.text.all"),
			value: "all"
		});
		return _list;
	});
	return function getStaffList() {
		return _ref.apply(this, arguments);
	};
}();
const getProductChannel = function() {
	var _ref2 = _asyncToGenerator(function* () {
		const { data } = yield request.getRequest().get("/shop/order/platform-list", {}, { fullResult: true });
		let _list = (data || []).map((d) => {
			return {
				label: d.name,
				value: d.platform
			};
		});
		_list.unshift({
			label: locales.getText("pisell2.text.all"),
			value: "all"
		});
		return _list;
	});
	return function getProductChannel() {
		return _ref2.apply(this, arguments);
	};
}();
const getOrderTypes = function() {
	var _ref4 = _asyncToGenerator(function* () {
		var _ref3;
		let { data } = yield request.getRequest().get("/shop/order/aggregation-type", {}, { fullResult: true });
		let _list = (_ref3 = data || []) === null || _ref3 === void 0 ? void 0 : _ref3.map((d) => {
			return _objectSpread2(_objectSpread2({}, d), {}, {
				label: d.name,
				value: d.type
			});
		});
		_list.unshift({
			label: locales.getText("pisell2.text.all"),
			value: "all"
		});
		return _list;
	});
	return function getOrderTypes() {
		return _ref4.apply(this, arguments);
	};
}();
const getPaymentTypes = function() {
	var _ref6 = _asyncToGenerator(function* () {
		var _ref5;
		let { data } = yield request.getRequest().get("/shop/till/opened-payment-method", {}, { fullResult: true });
		let _list = (_ref5 = data || []) === null || _ref5 === void 0 ? void 0 : _ref5.map((d) => {
			return _objectSpread2(_objectSpread2({}, d), {}, {
				label: d.name,
				value: d.code
			});
		});
		_list.unshift({
			label: locales.getText("pisell2.text.all"),
			value: "all"
		});
		return _list;
	});
	return function getPaymentTypes() {
		return _ref6.apply(this, arguments);
	};
}();
//#endregion
export { getOrderTypes, getPaymentTypes, getProductChannel, getStaffList };
