#ifndef DECK_READING_IO_H
#define DECK_READING_IO_H

#include <stdbool.h>
#include <stddef.h>

/* Header-only dependency on the engine, same policy as significance.h -
 * see its comment for why. */
#include "../../engine/src/reading.h"

/* Parses deck-engine's `--format json` output (text, null-terminated at
 * text[length]) and fills *out with just enough of a DailyReading for
 * interpret_daily_reading() to work on: out->transits.aspects[]/
 * aspect_count. out->natal and out->spread are left zeroed - nothing
 * here reads them (see significance.c), so there's no reason to parse
 * the rest of the document yet.
 *
 * Returns false on malformed JSON, or if "transits"."aspects" isn't
 * present as an array (an empty array is fine - that's a real "no
 * aspects today" reading, not an error). */
bool reading_load_json(const char *text, size_t length, DailyReading *out);

#endif
