# app/config.py
"""Application configuration."""

from typing import List

from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
    """Application settings."""

    model_config = SettingsConfigDict(
        env_file=".env",
        env_file_encoding="utf-8",
        case_sensitive=False,
        extra="ignore",
    )

    # API Configuration
    API_TITLE: str = "Berlin Picnic Zone Finder API"
    API_VERSION: str = "1.0.0"
    DEBUG: bool = False
    HOST: str = "0.0.0.0"
    PORT: int = 8000

    # CORS Settings
    ALLOWED_ORIGINS: List[str] = [
        "http://localhost:3000",
        "http://127.0.0.1:3000",
        "https://your-frontend-domain.com",
    ]

    # Berlin Open Data APIs
    BERLIN_OPEN_DATA_API_KEY: str = ""
    EBIRD_API_KEY: str = ""
    INATURALIST_API_URL: str = "https://api.inaturalist.org/v1"

    # Database
    DATABASE_URL: str = "sqlite:///./berlin_zones.db"

    # Redis Cache
    REDIS_URL: str = "redis://localhost:6379"
    CACHE_TTL: int = 3600

    # External APIs
    OPENSTREETMAP_API_URL: str = "https://nominatim.openstreetmap.org"
    WEATHER_API_KEY: str = ""

    # Logging
    LOG_LEVEL: str = "INFO"
    LOG_FORMAT: str = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"

    # Data Processing
    MAX_ZONES_PER_REQUEST: int = 100
    DEFAULT_SEARCH_RADIUS: int = 1000  # meters
    SCORING_CACHE_TTL: int = 1800  # seconds

    # Berlin specific
    BERLIN_CENTER_LAT: float = 52.5200
    BERLIN_CENTER_LNG: float = 13.4050
    BERLIN_BBOX: List[float] = [
        13.0883,
        52.3382,
        13.7611,
        52.6755,
    ]  # [min_lng, min_lat, max_lng, max_lat]


# Create settings instance
settings = Settings()
