Files
bolar_2/main/schedule/alarm_schedule.h
2026-11-27 16:38:11 +08:00

36 lines
856 B
C++

#pragma once
#include "schedule/schedule_types.h"
#include <cstddef>
#include <cstdint>
namespace borla {
class AlarmSchedule final {
public:
bool Upsert(const AlarmEntry& alarm);
bool Delete(int32_t id);
bool Replace(const AlarmList& alarms);
bool EnsureBuiltInFirstDay(bool consumed);
AlarmFireBatch TakeDue(
const CalendarMinute& local_time,
int64_t epoch_seconds);
const AlarmList& list() const { return alarms_; }
bool first_day_consumed() const { return first_day_consumed_; }
static bool Validate(const AlarmEntry& alarm);
static bool Matches(
const AlarmEntry& alarm,
const CalendarMinute& local_time,
int64_t epoch_seconds);
private:
AlarmList alarms_{};
bool first_day_consumed_ = false;
int64_t last_fired_minute_key_ = -1;
};
} // namespace borla