import React from 'react';
import { isFreeSelectionContiguousSameResource } from "../utils/bookingCalendarDateUtils";
import { tCal } from "../calendarI18n";
/** 日视图底部：多选空闲 / 锁台后的固定操作条 */
export function BookingCalendarDaySelectionBar(_ref) {
  var slotStepHours = _ref.slotStepHours,
    selectedFreeSlots = _ref.selectedFreeSlots,
    resourceSelectionSummary = _ref.resourceSelectionSummary,
    deselectAll = _ref.deselectAll,
    onOpenBlockPanel = _ref.onOpenBlockPanel,
    createBookingFromSelection = _ref.createBookingFromSelection;
  var hasFree = resourceSelectionSummary != null ? resourceSelectionSummary.freePickCount > 0 : selectedFreeSlots.length > 0;
  if (!hasFree) {
    return null;
  }
  /**
   * 是否允许「Block」与「Create booking」操作。
   * - 资源视图：仅当同一 court 连续多天 → `freeAllowsBlockPanel = true`
   * - 日视图：仅当同一 court 连续小时槽 → `isFreeSelectionContiguousSameResource = true`
   *
   * Create booking 与 Block 共用判定：散乱选择不允许任何创建动作。
   */
  var allowCreateOrBlock = resourceSelectionSummary != null ? resourceSelectionSummary.freeAllowsBlockPanel : isFreeSelectionContiguousSameResource(selectedFreeSlots, slotStepHours);
  return /*#__PURE__*/React.createElement("div", {
    className: "fixed bottom-6 left-1/2 z-50 -translate-x-1/2"
  }, /*#__PURE__*/React.createElement("div", {
    className: "flex max-w-[92vw] flex-wrap items-center justify-center gap-3 rounded-2xl border border-white/10 bg-black/55 px-4 py-3 shadow-2xl shadow-black/40 backdrop-blur-xl"
  }, /*#__PURE__*/React.createElement("button", {
    type: "button",
    onClick: deselectAll,
    className: "rounded-xl bg-red-500/85 px-4 py-2 text-sm font-semibold text-white"
  }, tCal('pisell2.recordBoard.calendar.day.deselectAll')), allowCreateOrBlock && /*#__PURE__*/React.createElement("button", {
    type: "button",
    onClick: onOpenBlockPanel,
    className: "rounded-xl bg-zinc-500/90 px-5 py-3 text-sm font-semibold text-white"
  }, tCal('pisell2.recordBoard.calendar.day.block')), allowCreateOrBlock && /*#__PURE__*/React.createElement("button", {
    type: "button",
    onClick: createBookingFromSelection,
    className: "rounded-xl bg-violet-600 px-6 py-3 text-sm font-semibold text-white"
  }, tCal('pisell2.recordBoard.calendar.day.createBooking'))));
}