72 lines
2.1 KiB
TypeScript
72 lines
2.1 KiB
TypeScript
/** The tarot deck and spreads (the backend draws from the same deck file). */
|
|||
|
|
|
||
|
|
import deckData from "@/content/tarot-deck.json";
|
||
|
|
|
||
|
|
export type TarotSuit = "major" | "wands" | "cups" | "swords" | "pentacles";
|
||
|
|
export type TarotElement = "Tűz" | "Víz" | "Levegő" | "Föld" | "Éter";
|
||
|
|
export type MinorRank = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | "page" | "knight" | "queen" | "king";
|
||
|
|
|
||
|
|
export interface TarotCardData {
|
||
|
|
id: string;
|
||
|
|
number: number;
|
||
|
|
roman?: string;
|
||
|
|
rank?: MinorRank;
|
||
|
|
nameHu: string;
|
||
|
|
nameEn: string;
|
||
|
|
suit: TarotSuit;
|
||
|
|
suitLabelHu: string;
|
||
|
|
element: TarotElement;
|
||
|
|
astroRuler: string;
|
||
|
|
astroGlyph: string;
|
||
|
|
keywords: string[];
|
||
|
|
upright: string;
|
||
|
|
reversed: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const DECK = deckData as TarotCardData[];
|
||
|
|
|
||
|
|
export function tarotCard(id: string): TarotCardData | undefined {
|
||
|
|
return DECK.find((c) => c.id === id);
|
||
|
|
}
|
||
|
|
|
||
|
|
export type SpreadId = "daily" | "trinity" | "astro_cross";
|
||
|
|
|
||
|
|
/** The spreads to choose from (the positions come with the reading). */
|
||
|
|
export const SPREADS: { id: SpreadId; name: string; cards: number; about: string }[] = [
|
||
|
|
{ id: "daily", name: "Napi iránymutatás", cards: 1, about: "Egy lap: mire hangolódj ma." },
|
||
|
|
{ id: "trinity", name: "Sorsfonalak hármas", cards: 3, about: "Három lap: előzmény, jelen, kibontakozás." },
|
||
|
|
{
|
||
|
|
id: "astro_cross",
|
||
|
|
name: "Képlet-kereszt",
|
||
|
|
cards: 5,
|
||
|
|
about: "Öt lap: központi téma, belső és tudatos erők, kihívás, útmutatás.",
|
||
|
|
},
|
||
|
|
];
|
||
|
|
|
||
|
|
/** Longest question (the backend's `TAROT_QUESTION_MAX_CHARS`). */
|
||
|
|
export const TAROT_QUESTION_MAX = 300;
|
||
|
|
|
||
|
|
export interface TarotContent {
|
||
|
|
title: string;
|
||
|
|
summary: string;
|
||
|
|
cards: { body: string }[];
|
||
|
|
synthesis: string;
|
||
|
|
advice: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** A reading (`/v1/tarot/readings`). */
|
||
|
|
export interface TarotReading {
|
||
|
|
id: string;
|
||
|
|
status: "pending" | "running" | "done" | "failed";
|
||
|
|
spread: SpreadId;
|
||
|
|
spread_name: string | null;
|
||
|
|
question: string | null;
|
||
|
|
cards: { card: string; reversed: boolean; position: string | null; about: string | null }[];
|
||
|
|
content: TarotContent | null;
|
||
|
|
error: string | null;
|
||
|
|
credits_charged: number;
|
||
|
|
attempts: number;
|
||
|
|
created_at: string;
|
||
|
|
completed_at: string | null;
|
||
|
|
}
|