import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import { request } from "../utils.js";
import { getScheduleList } from "../schedules/serve.js";
//#region src/components/schedules/products/serve.ts
const getProductList = function() {
	var _ref = _asyncToGenerator(function* (params) {
		let { data } = yield 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 = _asyncToGenerator(function* (params) {
		return yield request.getRequest().get("/shop/schedule/item/relation", params);
	});
	return function getProductDetail(_x2) {
		return _ref2.apply(this, arguments);
	};
}();
const editProductDetail = function() {
	var _ref3 = _asyncToGenerator(function* (params) {
		return yield request.getRequest().post("/shop/schedule/item/relation", params);
	});
	return function editProductDetail(_x3) {
		return _ref3.apply(this, arguments);
	};
}();
const getScheduleListByProductId = function() {
	var _ref4 = _asyncToGenerator(function* (params) {
		if (params.ids.length) {
			let { data } = yield 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 = _asyncToGenerator(function* (params) {
		let { data } = yield getScheduleList(params);
		return data.list || [];
	});
	return function getSchedules(_x5) {
		return _ref5.apply(this, arguments);
	};
}();
const getResourcesByProductId = function() {
	var _ref6 = _asyncToGenerator(function* (params) {
		let { data } = yield request.getRequest().get(`/shop/form/resources/${params.id}`);
		return data || [];
	});
	return function getResourcesByProductId(_x6) {
		return _ref6.apply(this, arguments);
	};
}();
//#endregion
export { editProductDetail, getProductDetail, getProductList, getResourcesByProductId, getScheduleListByProductId, getSchedules };
