#ifndef WATCH_CONFIG_H
#define WATCH_CONFIG_H

#include <pebble.h>

#include "../../../engine/src/astro.h"
#include "../../../engine/src/tarot.h" /* Gender */

/* Everything the watch needs that isn't computed fresh each day: birth
 * data (the same fields as dist/user.properties), display language, and
 * daily notification settings. Persisted on-watch via Pebble's own
 * key-value persist API (see config.c) - no companion app, no server,
 * matching the rest of this project's architecture. */
typedef struct {
  bool configured; /* false until the config page has been submitted once */
  BirthData birth;
  Gender gender; /* who the reading is for - only affects Celtic Cross
                  * position text pronouns, see engine/src/tarot.h.
                  * Defaults to GENDER_UNSPECIFIED (0). */
  char lang[8]; /* e.g. "en", "de" - matches engine/i18n/<lang>.lang's own code */
  bool notify_enabled;
  int notify_hour;   /* 0-23, the watch's own local wall-clock time (i.e.
                       * localtime(), not birth.utc_offset_hours - the
                       * user's current timezone, synced from their phone,
                       * not necessarily their birth location's). */
  int notify_minute; /* 0-59 */
} WatchConfig;

/* Fills `out` with the persisted config, or a safe all-zero/`configured
 * = false` default if nothing has been saved yet (first run). */
void config_load(WatchConfig *out);

void config_save(const WatchConfig *cfg);

/* Prints `cfg` via APP_LOG - the same fields a reading is computed from,
 * so callers can confirm on-device what values a shown reading is
 * actually based on (there's no way to read them back from the watch
 * otherwise). Prints "not configured yet" instead if !cfg->configured. */
void config_log(const WatchConfig *cfg);

#endif
