require("../../../_virtual/_rolldown/runtime.js");
const require_serve = require("../schedules/serve.js");
let react = require("react");
let ahooks = require("ahooks");
//#region src/components/schedules/hooks/useSchedulesDataSource.ts
const useSchedulesDataSource = (params) => {
	const { scheduleIds } = params || {};
	const [dataSource, setDataSource] = (0, react.useState)([]);
	const { loading, run, refresh } = (0, ahooks.useRequest)(require_serve.postScheduleList, {
		manual: true,
		onSuccess: (result, params) => {
			if (result.status) setDataSource(result.data.list);
		}
	});
	(0, react.useEffect)(() => {
		run({
			ids: scheduleIds,
			skip: 1,
			num: 500,
			with: ["relation", "timeSlot"],
			with_count: ["relation", "order"]
		});
	}, [scheduleIds]);
	return {
		loading,
		dataSource,
		refresh
	};
};
//#endregion
exports.default = useSchedulesDataSource;
