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/plus/pisellReservation/hooks/usePisellReservationResourceTableData.ts
var usePisellReservationResourceTableData_exports = {};
__export(usePisellReservationResourceTableData_exports, {
  usePisellReservationResourceTableData: () => usePisellReservationResourceTableData
});
module.exports = __toCommonJS(usePisellReservationResourceTableData_exports);
var import_react = require("react");
var import_ahooks = require("ahooks");
var import_formResourcePage = require("../serve/formResourcePage");
var import_usePisellReservationBookingData = require("./usePisellReservationBookingData");
var RESOURCE_PAGE_NUM = 999;
function usePisellReservationResourceTableData(enabled) {
  var _a, _b;
  const fetchList = (0, import_ahooks.useMemoizedFn)(async () => {
    return (0, import_formResourcePage.getFormResourcePage)({ num: RESOURCE_PAGE_NUM });
  });
  const req = (0, import_ahooks.useRequest)(fetchList, { manual: true });
  (0, import_react.useEffect)(() => {
    if (!enabled) return;
    void req.run();
  }, [enabled, req.run]);
  const onPageChange = (0, import_react.useCallback)((pageNumber, pageSize) => {
  }, []);
  const onSearch = (0, import_react.useCallback)(
    (_params) => {
      void req.refresh();
    },
    [req]
  );
  const onReset = (0, import_react.useCallback)(() => {
    void req.refresh();
  }, [req]);
  const patchSearchParams = (0, import_react.useCallback)(
    (updater) => {
      void req.refresh();
    },
    [req]
  );
  const searchParams = (0, import_react.useMemo)(() => ({}), []);
  const rawList = (_a = req.data) == null ? void 0 : _a.list;
  const data = (0, import_react.useMemo)(() => {
    if (!Array.isArray(rawList) || rawList.length === 0) {
      return import_usePisellReservationBookingData.EMPTY_RESERVATION_LIST;
    }
    return rawList;
  }, [rawList]);
  const total = ((_b = req.data) == null ? void 0 : _b.count) ?? 0;
  const pagination = (0, import_react.useMemo)(
    () => ({ pageNumber: 1, pageSize: RESOURCE_PAGE_NUM }),
    []
  );
  return {
    data,
    loading: req.loading,
    total,
    pagination,
    onPageChange,
    searchParams,
    onSearch,
    onReset,
    refresh: req.refresh,
    refreshAsync: req.refreshAsync,
    patchSearchParams
  };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  usePisellReservationResourceTableData
});
