var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/components/schedules/hooks/useSchedulesDataSource.ts
var useSchedulesDataSource_exports = {};
__export(useSchedulesDataSource_exports, {
  default: () => useSchedulesDataSource_default
});
module.exports = __toCommonJS(useSchedulesDataSource_exports);
var import_react = require("react");
var import_ahooks = require("ahooks");
var import_serve = require("../schedules/serve");
var useSchedulesDataSource = (params) => {
  const { scheduleIds } = params || {};
  const [dataSource, setDataSource] = (0, import_react.useState)([]);
  const { loading, run, refresh } = (0, import_ahooks.useRequest)(import_serve.postScheduleList, {
    manual: true,
    onSuccess: (result, params2) => {
      if (result.status) {
        setDataSource(result.data.list);
      }
    }
  });
  (0, import_react.useEffect)(() => {
    run({
      ids: scheduleIds,
      skip: 1,
      num: 500,
      with: ["relation", "timeSlot"],
      with_count: ["relation", "order"]
    });
  }, [scheduleIds]);
  return {
    loading,
    dataSource,
    refresh
  };
};
var useSchedulesDataSource_default = useSchedulesDataSource;
