"""Application configuration."""

from functools import lru_cache
from pydantic_settings import BaseSettings


class Settings(BaseSettings):
    """Application settings from environment variables."""

    # Database
    database_url: str = "postgresql+asyncpg://app:changeme@localhost:5432/mockupaws"

    # Application
    app_name: str = "mockupAWS"
    debug: bool = False

    # Pagination
    default_page_size: int = 20
    max_page_size: int = 100

    # Report Storage
    reports_storage_path: str = "./storage/reports"
    reports_max_file_size_mb: int = 50
    reports_cleanup_days: int = 30
    reports_rate_limit_per_minute: int = 10

    # JWT Configuration
    jwt_secret_key: str = "super-secret-change-in-production"
    jwt_algorithm: str = "HS256"
    access_token_expire_minutes: int = 30
    refresh_token_expire_days: int = 7

    # Security
    bcrypt_rounds: int = 12

    class Config:
        env_file = ".env"
        case_sensitive = False
        extra = "ignore"


@lru_cache()
def get_settings() -> Settings:
    """Get cached settings instance."""
    return Settings()


settings = get_settings()
