/**
 * 日视图表头：每列整点仍空闲资源占比。
 */
import { useMemo } from 'react';
import { dayOccupancy } from "../../utils/bookingCalendarDateUtils";
export function useBookingCalendarDayHourRemaining(visibleCourts, dayKey, bookings, hourSlots, slotStepHours, isBusinessHour) {
  return useMemo(function () {
    var total = visibleCourts.length;
    return Object.fromEntries(hourSlots.map(function (hour) {
      if (!isBusinessHour(hour)) return [hour, {
        remaining: 0,
        total: total,
        ratio: 0
      }];
      var remaining = visibleCourts.filter(function (court) {
        return !dayOccupancy(court.id, dayKey, bookings, hourSlots, slotStepHours)[hour];
      }).length;
      var ratio = total > 0 ? remaining / total : 0;
      return [hour, {
        remaining: remaining,
        total: total,
        ratio: ratio
      }];
    }));
  }, [visibleCourts, dayKey, bookings, hourSlots, slotStepHours, isBusinessHour]);
}