export const CHART_LAYOUT_PADDING = { left: 8, right: 45 } as const

export const SLOT_MS = 15 * 60 * 1000
export const SLOT_COUNT_BACK = 60
export const SLOT_COUNT_FWD = 144
export const TOTAL_SLOTS = SLOT_COUNT_BACK + SLOT_COUNT_FWD

export function floorSlotUtcMs(ms: number): number {
  return Math.floor(ms / SLOT_MS) * SLOT_MS
}

/** Index aktuálního 15min slotu v okně [0, TOTAL_SLOTS). */
export function currentSlotIndexInWindow(windowStartMs: number): number {
  const cur = floorSlotUtcMs(Date.now())
  return Math.round((cur - windowStartMs) / SLOT_MS)
}
