"""
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 = ""

    # ── MySQL (Al-Arcade Remote DB) ───────────────────────
    MYSQL_HOST: str = "scenariodb.caprover.al-arcade.com"
    MYSQL_PORT: int = 3306
    MYSQL_USER: str = "root"
    MYSQL_PASSWORD: str = "Alarcade123#"
    MYSQL_DATABASE: str = "mcq_app"

    # ── 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()
