import { useCallback } from "react";
//#region src/components/pisellRecordBoard/shellFrame/Calendar/view/resource/useBookingCalendarResourceCellToggle.ts
/**
* 资源视图：cell (court, date) 整天选中切换（状态仍在 Shell，与 SelectionBar 共用）。
*/
function useBookingCalendarResourceCellToggle(setSelectedResourceCells) {
	return useCallback((courtId, dateKey) => {
		setSelectedResourceCells((prev) => {
			if (prev.some((s) => s.courtId === courtId && s.dateKey === dateKey)) return prev.filter((s) => !(s.courtId === courtId && s.dateKey === dateKey));
			return [...prev, {
				courtId,
				dateKey
			}];
		});
	}, [setSelectedResourceCells]);
}
//#endregion
export { useBookingCalendarResourceCellToggle };
