import { buildDetailModalRoomCardData, resolveBookingIdForHeader } from "../floorRoomCard/mapRowToFloorRoomCardData.js";
import { FloorRoomCardFromData } from "../floorRoomCard/FloorRoomCardFromData.js";
import React, { useEffect, useMemo, useReducer } from "react";
//#region src/plus/pisellReservation/components/ReservationCalendarDayBookingRoomCard.tsx
/**
* 仅用于 {@link PisellReservation} 日历**日视图**时间轴 `renderBooking`；详情弹窗等处直接用 {@link FloorRoomCardFromData}。
* 外层时间槽已由日历算出宽高，此处不再做 scale，与弹窗内一样靠 **100% 铺宽**（极窄槽由 `overflow:hidden` + 卡片内 truncate 处理）。
*/
function ReservationCalendarDayBookingRoomCard(props) {
	const { raw, tableRow } = props;
	const [, bumpLayoutTick] = useReducer((x) => x + 1, 0);
	useEffect(() => {
		const id = window.setInterval(() => bumpLayoutTick(), 6e4);
		return () => window.clearInterval(id);
	}, []);
	const data = useMemo(() => buildDetailModalRoomCardData(raw, tableRow), [raw, tableRow]);
	const headerMainFieldOverride = useMemo(() => resolveBookingIdForHeader(raw), [raw]);
	return /* @__PURE__ */ React.createElement("div", {
		className: "pisell-res-floor-room-card",
		style: {
			width: "100%",
			height: "100%",
			overflow: "hidden",
			boxSizing: "border-box",
			minHeight: 0,
			minWidth: 0,
			display: "flex",
			flexDirection: "column"
		}
	}, /* @__PURE__ */ React.createElement("div", { style: {
		flex: 1,
		minWidth: 0,
		minHeight: 0,
		width: "100%",
		display: "flex",
		flexDirection: "column"
	} }, /* @__PURE__ */ React.createElement(FloorRoomCardFromData, {
		data,
		shellShape: "rect",
		hideHeaderCapacity: true,
		headerMainFieldOverride
	})));
}
//#endregion
export { ReservationCalendarDayBookingRoomCard };
