"""Time-of-day periods and atmospheric descriptions."""

from __future__ import annotations


def get_time_period(hour: int) -> str:
    """Map a game hour (0-23) to a time period.

    Args:
        hour: Game hour (0-23)

    Returns:
        Time period: "dawn", "day", "dusk", or "night"
    """
    if 5 <= hour <= 6:
        return "dawn"
    elif 7 <= hour <= 17:
        return "day"
    elif 18 <= hour <= 19:
        return "dusk"
    else:
        return "night"


def get_sky_description(hour: int) -> str:
    """Return an atmospheric one-liner for the current time of day.

    Args:
        hour: Game hour (0-23)

    Returns:
        Short atmospheric description based on time of day
    """
    period = get_time_period(hour)

    # multiple variants per period, pick based on hour for determinism
    descriptions = {
        "dawn": [
            "pale light seeps across the horizon",
            "the first rays of dawn touch the sky",
        ],
        "day": [
            "the sun hangs high overhead",
            "bright daylight illuminates everything",
            "warm light fills the air",
            "midday light is at its strongest",
            "golden afternoon light slants across the land",
            "the day is bright and warm",
            "light glints off distant surfaces",
            "the sun begins its slow descent",
            "late afternoon shadows grow longer",
            "the sun drifts toward the western horizon",
            "the day's light begins to soften",
        ],
        "dusk": [
            "the sky burns orange and violet",
            "twilight deepens across the landscape",
        ],
        "night": [
            "stars wheel slowly overhead",
            "darkness blankets the world",
            "the night is deep and still",
            "moonlight casts pale shadows",
            "the hours before dawn stretch long and dark",
        ],
    }

    variants = descriptions[period]
    # use hour to pick variant deterministically
    return variants[hour % len(variants)]
