//#region src/components/pisellRecordBoard/shellFrame/Calendar/utils/bookingCalendarSelectionUtils.ts
/**
* 资源视图选区是否「同一 court + 连续多天」：
* 仅当满足时才允许 Block / Create Booking（与日视图「同 court 连续多小时」语义对应）。
* 单天选中（n === 1）也算连续。
*/
function isResourceSelectionContiguousSameCourt(selections) {
	if (selections.length === 0) return false;
	const courtId = selections[0].courtId;
	if (selections.some((s) => s.courtId !== courtId)) return false;
	if (selections.length === 1) return true;
	const dates = [...selections].map((s) => s.dateKey).sort().map((s) => new Date(s).getTime());
	for (let i = 1; i < dates.length; i += 1) if (Math.round((dates[i] - dates[i - 1]) / 864e5) !== 1) return false;
	return true;
}
//#endregion
export { isResourceSelectionContiguousSameCourt };
