"""
PY-Tarot: A comprehensive Python library for Tarot card reading and interpretation.

This library provides:
- Full 78-card Tarot deck with Major and Minor Arcana
- Kabbalistic correspondences and Tree of Life data
- Multiple configurable cipher systems (Hebrew, English, Greek, Reduction)
- Tarot alphabets (English, Greek, Hebrew) with meanings
- Numbers 1-9 with Sepheric attributes and digital root calculation
- Crowley 777 color system with Sephiroth correspondences
- Full type hints for IDE support and type checking

Unified Namespaces (singular names):
    number   - Numerology and number correspondences
    letter   - Alphabets (English, Hebrew, Greek), ciphers, and word analysis
    Tarot    - Tarot-specific (deck, cards, tree, cube, temporal)

Usage:
    from tarot import number, letter, words, Tarot

    num = number.number(5)
    result = letter.words.word('MAGICK').cipher('english_simple')
    card = Tarot.deck.card(3)
"""

import kaballah
from kaballah import Cube, Tree
from kaballah.cube.attributes import CubeOfSpace, Wall, WallDirection

# Import from namespace folders
from letter import hexagram, letter, trigram
from number import calculate_digital_root, number
from temporal import PlanetPosition, ThalemaClock
from temporal import Zodiac as AstrologyZodiac

# Import shared attributes from utils
from utils.attributes import (
    Cipher,
    CipherResult,
    Color,
    Colorscale,
    Element,
    ElementType,
    God,
    Note,
    Number,
    Perfume,
    Planet,
)

from .attributes import (
    AstrologicalInfluence,
    CardImage,
    ClockHour,
    Correspondences,
    Day,
    Degree,
    DoublLetterTrump,
    EnglishAlphabet,
    EnochianArchetype,
    EnochianGridPosition,
    EnochianTablet,
    GreekAlphabet,
    HebrewAlphabet,
    Hexagram,
    Hour,
    Letter,
    Meaning,
    Month,
    Path,
    PeriodicTable,
    Sephera,
    Suit,
    TreeOfLife,
    Trigram,
    Weekday,
    Zodiac,
)

# Import from card module (includes details, loader, and image_loader)
from .card import (
    CardAccessor,
    CardDetailsRegistry,
    ImageDeckLoader,
    filter_cards_by_keywords,
    get_card_info,
    get_cards_by_suit,
    load_card_details,
    load_deck_details,
    load_deck_images,
    print_card_details,
)
from .card.data import CardDataLoader
from .deck import DLT, Card, Deck, MajorCard, MinorCard
from .tarot_api import Tarot


def display(obj):
    """
    Pretty print any tarot object by showing all its attributes.

    Automatically detects dataclass objects and displays their fields
    with values in a readable format.

    Usage:
        from tarot import display, number
        num = number.number(5)
        display(num)  # Shows all attributes nicely formatted
    """
    from dataclasses import fields

    if hasattr(obj, "__dataclass_fields__"):
        # It's a dataclass - show all fields
        print(f"{obj.__class__.__name__}:")
        for field in fields(obj):
            value = getattr(obj, field.name)
            print(f"  {field.name}: {value}")
    else:
        print(obj)


__version__ = "0.1.0"
__author__ = "PY-Tarot Contributors"
__all__ = [
    # Namespaces (singular)
    "number",
    "letter",
    "kaballah",
    "Tarot",
    "trigram",
    "hexagram",
    # Temporal and astrological
    "ThalemaClock",
    "AstrologyZodiac",
    "PlanetPosition",
    # Card details and loading
    "CardDetailsRegistry",
    "load_card_details",
    "load_deck_details",
    "get_cards_by_suit",
    "filter_cards_by_keywords",
    "print_card_details",
    "get_card_info",
    # Image loading
    "ImageDeckLoader",
    "load_deck_images",
    # Utilities
    "display",
    "CardAccessor",
    "Tree",
    "Cube",
    # Deck classes
    "Deck",
    "Card",
    "MajorCard",
    "MinorCard",
    "DLT",
    # Calendar/attribute classes
    "Month",
    "Day",
    "Weekday",
    "Hour",
    "ClockHour",
    "Zodiac",
    "Suit",
    "Meaning",
    "Letter",
    "Note",
    "CubeOfSpace",
    "WallDirection",
    "Wall",
    # Sepheric classes
    "Sephera",
    "PeriodicTable",
    "Degree",
    "Element",
    "ElementType",
    "AstrologicalInfluence",
    "TreeOfLife",
    "Correspondences",
    "CardImage",
    "DoublLetterTrump",
    "EnochianTablet",
    "EnochianGridPosition",
    "EnochianArchetype",
    # Alphabet classes
    "EnglishAlphabet",
    "GreekAlphabet",
    "HebrewAlphabet",
    # Number and color classes
    "Number",
    "Color",
    "Planet",
    "God",
    "Trigram",
    "Hexagram",
    "Cipher",
    "CipherResult",
    # Data loader and functions
    "CardDataLoader",
    "calculate_digital_root",
]
