const require_asyncToGenerator = require("../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
const require_utils = require("../utils.js");
const require_serve = require("../schedules/serve.js");
//#region src/components/schedules/products/serve.ts
const getProductList = function() {
	var _ref = require_asyncToGenerator._asyncToGenerator(function* (params) {
		let { data } = yield require_utils.request.getRequest().post("/shop/product/query", params, { abort: true });
		return (data === null || data === void 0 ? void 0 : data.list) || [];
	});
	return function getProductList(_x) {
		return _ref.apply(this, arguments);
	};
}();
const getProductDetail = function() {
	var _ref2 = require_asyncToGenerator._asyncToGenerator(function* (params) {
		return yield require_utils.request.getRequest().get("/shop/schedule/item/relation", params);
	});
	return function getProductDetail(_x2) {
		return _ref2.apply(this, arguments);
	};
}();
const editProductDetail = function() {
	var _ref3 = require_asyncToGenerator._asyncToGenerator(function* (params) {
		return yield require_utils.request.getRequest().post("/shop/schedule/item/relation", params);
	});
	return function editProductDetail(_x3) {
		return _ref3.apply(this, arguments);
	};
}();
const getScheduleListByProductId = function() {
	var _ref4 = require_asyncToGenerator._asyncToGenerator(function* (params) {
		if (params.ids.length) {
			let { data } = yield require_serve.getScheduleList(params);
			return params.ids.map((id) => data === null || data === void 0 ? void 0 : data.list.find((item) => item.id === id)).filter(Boolean) || [];
		}
		return [];
	});
	return function getScheduleListByProductId(_x4) {
		return _ref4.apply(this, arguments);
	};
}();
const getSchedules = function() {
	var _ref5 = require_asyncToGenerator._asyncToGenerator(function* (params) {
		let { data } = yield require_serve.getScheduleList(params);
		return data.list || [];
	});
	return function getSchedules(_x5) {
		return _ref5.apply(this, arguments);
	};
}();
const getResourcesByProductId = function() {
	var _ref6 = require_asyncToGenerator._asyncToGenerator(function* (params) {
		let { data } = yield require_utils.request.getRequest().get(`/shop/form/resources/${params.id}`);
		return data || [];
	});
	return function getResourcesByProductId(_x6) {
		return _ref6.apply(this, arguments);
	};
}();
//#endregion
exports.editProductDetail = editProductDetail;
exports.getProductDetail = getProductDetail;
exports.getProductList = getProductList;
exports.getResourcesByProductId = getResourcesByProductId;
exports.getScheduleListByProductId = getScheduleListByProductId;
exports.getSchedules = getSchedules;
