const require_runtime = require("../../../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_model = require("../../../../model.js");
const require_serve = require("../../../serve.js");
const require_index = require("../../../../components/ResourceList/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let ahooks = require("ahooks");
//#region src/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.tsx
const ResourcesModule = ({ product }) => {
	const { state, dispatch } = (0, react.useContext)(require_model.Context);
	const _getResourcesByProductId = (0, ahooks.useRequest)(require_serve.getResourcesByProductId, { manual: true });
	(0, react.useEffect)(() => {
		if (product) {
			console.log("product", product);
			_getResourcesByProductId.run({ id: product.id });
		}
	}, [product]);
	const goResource = (item) => {
		dispatch({
			type: "setState",
			payload: {
				tabKey: "resources",
				resources: require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, state.resources), {}, { cacheResource: item })
			}
		});
	};
	return /* @__PURE__ */ react.default.createElement("div", { className: "product-detail-card-module" }, /* @__PURE__ */ react.default.createElement("div", { className: "product-detail-card-title" }, _pisell_utils.locales.getText("pisell2.text.schedules.resources-title")), /* @__PURE__ */ react.default.createElement(require_index.default, {
		dataSource: _getResourcesByProductId.data || [],
		loading: _getResourcesByProductId.loading,
		onClick: goResource
	}));
};
//#endregion
exports.default = ResourcesModule;
