"""
Configuration — central environment variables definitions using pydantic-settings
"""

from pydantic_settings import BaseSettings
from functools import lru_cache


class Settings(BaseSettings):
    # ── Groq API ────────────────────────────────────────────
    GROQ_API_KEY: str = ""

    # Model used for scenario generation and chat
    GROQ_MODEL: str = "llama-3.3-70b-versatile"
    
    # ── SerpAPI ─────────────────────────────────────────────
    SERPAPI_API_KEY: str = ""

    # ── Supabase (PostgreSQL) ─────────────────────────────────
    SUPABASE_DB_URL: str = ""

    # ── Defaults for Z-Score ──────────────────────────────
    DEFAULT_ZSCORE_WINDOW: int = 100
    DEFAULT_ZSCORE_TRIGGER_MIN: float = -2.5
    DEFAULT_ZSCORE_TRIGGER_MAX: float = 2.5

    class Config:
        env_file = ".env"
        env_file_encoding = "utf-8"


@lru_cache()
def get_settings() -> Settings:
    return Settings()
