#ifndef DECK_READING_H
#define DECK_READING_H

/* See astro.h's own comment on this same #ifdef - Pebble's SDK
 * pre-defines <time.h>'s include guard and declares time_t/struct tm
 * itself inside pebble.h. */
#ifdef PBL_SDK_3
#include <pebble.h>
#else
#include <stdio.h>
#include <time.h>
#endif

#include "astro.h"
#include "tarot.h"

typedef struct {
  /* The moment passed to reading_generate() - the day this reading is
   * for, not when it happened to be generated. Set by reading_generate()
   * itself, so every caller (CLI, watch, reading_load_json() on the
   * interpreter side) gets it for free without threading it through
   * separately. */
  time_t utc_moment;
  /* Who the reading is for - only affects the pronouns in the Celtic
   * Cross position text (see tarot.h's Gender), set by reading_generate()
   * the same way utc_moment is, so every caller gets it for free. */
  Gender gender;
  NatalChart natal;
  DailyTransits transits;
  CelticCrossSpread spread;
} DailyReading;

/* The real API: this is the only function the watchapp needs to call.
 * It walks the returned struct directly to lay out its own screens. */
void reading_generate(const char *tarot_seed, const BirthData *birth, Gender gender,
                       time_t utc_moment, DailyReading *out);

/* Desktop-only output formats for inspecting a reading before any watch
 * UI exists - use fprintf, which Pebble's SDK blocks at compile time, so
 * these aren't even declared (and reading.c doesn't define them) when
 * building for the watch. Not used by (and not needed by) the watchapp. */
#ifndef PBL_SDK_3
void reading_print_text(const DailyReading *r, FILE *out);
void reading_print_html(const DailyReading *r, FILE *out);

/* Machine-readable serialization of the full struct, using the
 * language-independent *_slug() accessors (never astro_*_name()/
 * tarot_*_name()) so the output is identical regardless of --lang. This
 * is the interchange format interpreter/ reads - see its json.c. */
void reading_print_json(const DailyReading *r, FILE *out);
#endif

#endif
