"""
FastAuth configuration settings.

All settings can be configured via environment variables or .env file.
Settings use Pydantic for validation and type coercion.
"""

from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
    """
    FastAuth configuration settings.

    All settings can be overridden via environment variables.
    For example, JWT_SECRET_KEY environment variable overrides jwt_secret_key.
    """

    jwt_secret_key: str = "CHANGE_ME_SUPER_SECRET"
    jwt_algorithm: str = "HS256"
    access_token_expire_minutes: int = 30
    require_email_verification: bool = True

    # Token expiration times
    email_verification_token_expiry_minutes: int = 60
    password_reset_token_expiry_minutes: int = 30
    email_change_token_expiry_minutes: int = 60
    refresh_token_expiry_days: int = 30

    email_backend: str = "console"

    smtp_host: str | None = None
    smtp_port: int = 587
    smtp_username: str | None = None
    smtp_password: str | None = None
    smtp_from_email: str = "no-reply@example.com"
    smtp_use_tls: bool = True

    google_client_id: str | None = None
    google_client_secret: str | None = None
    github_client_id: str | None = None
    github_client_secret: str | None = None
    microsoft_client_id: str | None = None
    microsoft_client_secret: str | None = None

    model_config = SettingsConfigDict(
        env_file=".env",
        extra="ignore",
    )


settings = Settings()
