#ifndef DECK_SIGNIFICANCE_H
#define DECK_SIGNIFICANCE_H

/* Header-only dependency on the engine: this module never compiles or
 * links the engine's own .c files (or the vendored Astronomy Engine),
 * only shares its struct/enum definitions. That's what makes it testable
 * with a hand-built DailyReading instead of a real reading_generate()
 * call - see interpreter/tests/significance_test.c. */
#include "../../engine/src/reading.h"

#include <stdbool.h>

#define MAX_SIGNIFICANT_ITEMS 5

/* Only aspects compete for the top-5 today. Kept as an explicit tag
 * (rather than assuming "item == aspect") so a future kind - e.g. a
 * notable moon phase or a house ingress - can be added without
 * reshaping this struct. */
typedef enum {
  ITEM_ASPECT = 0
} SignificantItemKind;

typedef struct {
  SignificantItemKind kind;
  Aspect aspect; /* valid when kind == ITEM_ASPECT */
  double score;  /* higher = more significant; no fixed upper bound */
} SignificantItem;

/* Overall classification of the day, derived from the top item's score.
 * A small enum, not a raw number, so callers (rendering, i18n, "does
 * this deserve Celtic Cross framing") don't each have to invent their
 * own thresholds. */
typedef enum {
  DAY_QUIET = 0,
  DAY_NOTABLE,
  DAY_SIGNIFICANT,
  DAY_MAJOR,
  DAY_SIGNIFICANCE_COUNT /* not a real level - the number of levels above,
                          * for callers that want to show day_level as a
                          * "rank out of N" (e.g. main.c's report). */
} DaySignificance;

typedef struct {
  SignificantItem top_items[MAX_SIGNIFICANT_ITEMS];
  int top_item_count; /* <= MAX_SIGNIFICANT_ITEMS; fewer if the day had
                        * fewer than 5 aspects in orb */
  DaySignificance day_level;
} DailyInterpretation;

/* Reads reading->transits.aspects[] only - never touches natal/spread,
 * and never calls back into the engine, so a hand-built DailyReading is
 * a complete, valid input. */
void interpret_daily_reading(const DailyReading *reading, DailyInterpretation *out);

/* True once day_level reaches the threshold at which the Celtic Cross
 * reading should get a "this matters" framing sentence naming
 * interp->top_items[0]. */
bool interpretation_deserves_framing(const DailyInterpretation *interp);

#endif
