#pragma once #include "network/api_client.h" #include #include namespace radiantwave::schedule { // Weekday keys matching the wire format. enum class Weekday { Mon = 0, Tue, Wed, Thu, Fri, Sat, Sun }; // The result of evaluating a schedule at a wall-clock instant. struct Decision { bool hasBlock = false; api::TargetBlock block; // valid only when hasBlock }; // The active Block for `payload` at (minutes, weekday), or none. Implements the // contract: half-open [start, end), midnight-crossing Blocks belong to their // start day (weekly Sunday spills into Monday), and a weekly mode must also // consider the previous day's crossing Block. Invalid Blocks (empty // proclamation list / bad range) are skipped and treated as gaps. // // Wall-clock minutes are passed in, so DST transitions behave naturally (the // caller supplies the local wall-clock time in the Kiosk's timezone). Decision evaluate(const api::SchedulePayload& payload, int minutes, Weekday weekday, std::function warn = nullptr); // True when `minutes` falls in the half-open [start, end) block, accounting for // a midnight-crossing range. bool minuteInBlock(int minutes, int startMinutes, int endMinutes); // Weekday from a 0=Monday..6=Sunday index (clamped). Weekday weekdayFromIndex(int index); } // namespace radiantwave::schedule