require("../../../../_virtual/_rolldown/runtime.js");
const require_asyncToGenerator = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js");
const require_useHolderConfig = require("./useHolderConfig.js");
let ahooks = require("ahooks");
//#region src/components/booking/info/hooks/useGetHolderList.ts
const useGetHolderList = (state, dispatch) => {
	const { holder, appointment_subject } = require_useHolderConfig.default(state);
	return (0, ahooks.useMemoizedFn)(require_asyncToGenerator._asyncToGenerator(function* () {
		var _state$client, _holder$form, _state$client2;
		if (holder.data_range === "customer" && !((_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id)) return;
		const params = {
			form_id: appointment_subject.form_id,
			source_shop_customer: holder === null || holder === void 0 || (_holder$form = holder.form) === null || _holder$form === void 0 ? void 0 : _holder$form.is_franchisor,
			customer_id: holder.data_range === "customer" ? (_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id : void 0,
			skip: 1,
			num: 100
		};
		dispatch({
			type: "setPet",
			payload: { holders: (yield state.apis.getPetsData(params)).list }
		});
	}));
};
//#endregion
exports.default = useGetHolderList;
