#ifndef WATCH_NOTIFY_H
#define WATCH_NOTIFY_H

#include "config.h"

/* (Re)schedules the daily notification wakeup from `cfg`'s notify_*
 * fields: cancels any wakeup this app previously scheduled, then - if
 * cfg->notify_enabled - schedules a new one-shot wakeup_schedule() for
 * the next occurrence of notify_hour:notify_minute in the watch's own
 * local time (today if that time hasn't passed yet, tomorrow otherwise).
 * If !cfg->notify_enabled, this only cancels - no new wakeup is
 * scheduled.
 *
 * Safe to call any time, and needs to be: once per app launch (Pebble's
 * wakeup_schedule() is one-shot - each firing consumes itself, so the
 * next day's has to be scheduled again after it fires or after a wakeup
 * that arrives while the app happens to already be open - see
 * notify_subscribe()) and on every config submission (settings may have
 * changed notify_enabled/notify_hour/notify_minute). */
void notify_reschedule(const WatchConfig *cfg);

/* True if this app launch was triggered by the daily notification wakeup
 * firing rather than the user/phone opening it normally - main.c uses
 * this to vibrate on launch, since the report window it pushes either
 * way already leads with day significance and the top transit (the
 * "quick digest" this notification promises), so no separate screen is
 * needed for it. */
bool notify_was_wakeup_launch(void);

/* Subscribes `handler` to fire if the scheduled wakeup goes off while
 * this app is already running in the foreground - the only case
 * notify_was_wakeup_launch() can't see, since no fresh launch happens
 * then (see wakeup_service_subscribe()'s own doc comment in pebble.h).
 * Call once, early in main(). */
void notify_subscribe(WakeupHandler handler);

#endif
