"""Application configuration."""

from pydantic_settings import BaseSettings


class Settings(BaseSettings):
    """Application settings."""
    
    PROJECT_NAME: str = "{{ project_name }}"
    VERSION: str = "0.1.0"
    DESCRIPTION: str = "A FastAPI application built with Plinth"
    
    # Server
    HOST: str = "0.0.0.0"
    PORT: int = 8000
    DEBUG: bool = False
    
    # CORS
    CORS_ORIGINS: list[str] = ["*"]
    
    {% if db_type %}
    # Database
    DATABASE_URL: str
    DATABASE_ECHO: bool = False
    {% endif %}
    
    {% if use_redis %}
    # Redis
    REDIS_URL: str = "redis://localhost:6379/0"
    REDIS_ENCODING: str = "utf-8"
    {% endif %}
    
    {% if auth_type == 'jwt' %}
    # JWT Auth
    SECRET_KEY: str
    ALGORITHM: str = "HS256"
    ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
    {% endif %}
    
    {% if auth_type == 'session' %}
    # Session Auth
    SECRET_KEY: str
    SESSION_COOKIE_NAME: str = "session"
    SESSION_MAX_AGE: int = 3600  # 1 hour
    {% endif %}
    
    class Config:
        env_file = ".env"
        env_file_encoding = "utf-8"


settings = Settings()
