#ifndef DECK_TAROT_H
#define DECK_TAROT_H

#include <stdbool.h>

#define TAROT_DECK_SIZE 22
#define TAROT_SPREAD_SIZE 10

typedef enum {
  CARD_FOOL = 0,
  CARD_MAGICIAN,
  CARD_HIGH_PRIESTESS,
  CARD_EMPRESS,
  CARD_EMPEROR,
  CARD_HIEROPHANT,
  CARD_LOVERS,
  CARD_CHARIOT,
  CARD_STRENGTH,
  CARD_HERMIT,
  CARD_WHEEL_OF_FORTUNE,
  CARD_JUSTICE,
  CARD_HANGED_MAN,
  CARD_DEATH,
  CARD_TEMPERANCE,
  CARD_DEVIL,
  CARD_TOWER,
  CARD_STAR,
  CARD_MOON,
  CARD_SUN,
  CARD_JUDGEMENT,
  CARD_WORLD
} TarotCard;

/* Waite's original ten positions from "An Ancient Celtic Method of
 * Divination" (The Pictorial Key to the Tarot, Part III §7), in his
 * original drawing order. */
typedef enum {
  POSITION_PRESENT = 0,     /* "This covers him." */
  POSITION_CHALLENGE,       /* "This crosses him." */
  POSITION_CROWN,           /* "This crowns him." */
  POSITION_FOUNDATION,      /* "This is beneath him." */
  POSITION_RECENT_PAST,     /* "This is behind him." */
  POSITION_NEAR_FUTURE,     /* "This is before him." */
  POSITION_ATTITUDE,        /* "Himself." */
  POSITION_ENVIRONMENT,     /* "His house." */
  POSITION_HOPES_AND_FEARS,
  POSITION_OUTCOME
} CelticCrossPosition;

typedef struct {
  TarotCard card;
  bool reversed;
} TarotDraw;

typedef struct {
  /* Indexed by CelticCrossPosition. */
  TarotDraw positions[TAROT_SPREAD_SIZE];
} CelticCrossSpread;

/* Deterministic: the same seed string always produces the same ten
 * cards, in the same positions, with the same orientations. */
void tarot_draw_celtic_cross(const char *seed, CelticCrossSpread *out);

/* Card content, sourced from A. E. Waite's Pictorial Key to the Tarot
 * (1911, public domain). Defined in tarot_data.c. */
const char *tarot_card_name(TarotCard card);
const char *tarot_card_image_file(TarotCard card); /* matches res/img/ */
const char *tarot_card_meaning(TarotCard card, bool reversed);

const char *tarot_position_name(CelticCrossPosition position);
const char *tarot_position_description(CelticCrossPosition position);

/* Stable, language-independent identifiers (e.g. "high_priestess",
 * "wheel_of_fortune", "recent_past") - the same strings i18n.c's lookup
 * keys are built from. Used for machine-readable output
 * (reading_print_json) that must stay identical regardless of --lang. */
const char *tarot_card_slug(TarotCard card);
const char *tarot_position_slug(CelticCrossPosition position);

#endif
