"""Configuration settings for the web backend."""

import os
from pathlib import Path

from pydantic_settings import BaseSettings


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

    # Server
    host: str = "0.0.0.0"
    port: int = 8000
    debug: bool = False

    # File handling
    max_upload_size_mb: int = 500
    temp_dir: Path = Path("/tmp/audio_splitter_web")
    cleanup_after_seconds: int = 3600  # 1 hour

    # CORS
    allow_origins: list[str] = ["http://localhost:5173", "http://localhost:3000"]

    class Config:
        env_file = ".env"
        env_file_encoding = "utf-8"


settings = Settings()

# Ensure temp directory exists
settings.temp_dir.mkdir(parents=True, exist_ok=True)