"""Конфигурация приложения. Все значения приходят из окружения (см. .env.example)."""

from functools import lru_cache

from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
    model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")

    # SSO (gnexus-gauth)
    gauth_base_url: str = "https://auth.gnexus.space"
    gauth_client_id: str = ""
    gauth_client_secret: str = ""
    gauth_redirect_uri: str = "http://localhost:5173/auth/callback"

    # Database
    database_url: str = "postgresql+psycopg://gntodo:gntodo@localhost:5432/gntodo"

    # Ollama (M2)
    ollama_base_url: str = "http://localhost:11434"
    ollama_model: str = "qwen2.5:3b"


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