"""
Temporal and astrological attributes.

This module defines attributes specific to the Temporal module,
including Zodiac, Time cycles, and Astrological influences.
"""

from dataclasses import dataclass, field
from typing import List


@dataclass
class Month:
    """Represents a calendar month."""

    number: int
    name: str
    zodiac_start: str
    zodiac_end: str


@dataclass
class Weekday:
    """Represents weekday/weekend archetypes with planetary ties."""

    number: int
    name: str
    planetary_correspondence: str
    is_weekend: bool = False
    keywords: List[str] = field(default_factory=list)

    def __post_init__(self) -> None:
        if not 1 <= self.number <= 7:
            raise ValueError(f"Weekday number must be between 1 and 7, got {self.number}")


@dataclass
class Hour:
    """Represents an hour with planetary correspondence."""

    number: int
    name: str
    planetary_hours: List[str] = field(default_factory=list)


@dataclass
class ClockHour:
    """Represents a clock hour with both 24-hour and 12-hour phases."""

    hour_24: int
    hour_12: int
    period: str  # AM or PM
    planetary_ruler: str
    description: str = ""
    time_of_day: str = field(init=False)

    def __post_init__(self) -> None:
        if not 0 <= self.hour_24 <= 23:
            raise ValueError(f"24-hour value must be between 0 and 23, got {self.hour_24}")
        if not 1 <= self.hour_12 <= 12:
            raise ValueError(f"12-hour value must be between 1 and 12, got {self.hour_12}")
        if self.period not in {"AM", "PM"}:
            raise ValueError(f"Period must be AM or PM, got {self.period}")
        self.time_of_day = "Day" if self.period == "AM" else "Night"


@dataclass
class Zodiac:
    """Represents a zodiac sign."""

    name: str
    symbol: str
    element: str
    ruling_planet: str
    date_range: str


@dataclass
class Degree:
    """Represents an astrological degree."""

    number: int
    constellation: str
    ruling_planet: str
    tarot_card: str


@dataclass
class AstrologicalInfluence:
    """Represents astrological influences."""

    planet: str
    sign: str
    house: str
    aspect: str
