from typing import Optional
from pydantic_settings import BaseSettings


class Settings(BaseSettings):
    app_name: str = "BasuraApp API"
    debug: bool = True
    secret_key: str = "CAMBIA_ESTO_EN_PRODUCCION_clave_super_secreta"
    algorithm: str = "HS256"
    access_token_expire_minutes: int = 60 * 24  # 24 horas

    # Database paths
    database_path: Optional[str] = None
    database_url: str = "sqlite:///./basura.db"

    # Supabase
    supabase_url: Optional[str] = None
    supabase_anon_key: Optional[str] = None
    supabase_service_key: Optional[str] = None

    # Redis
    redis_host: str = "localhost"
    redis_port: int = 6379
    redis_db: int = 0
    redis_password: Optional[str] = None

    # Cache settings
    cache_enabled: bool = True
    cache_ttl_eta: int = 30           # 30 segundos para ETA
    cache_ttl_addresses: int = 300    # 5 minutos para direcciones
    cache_ttl_guide: int = 86400      # 24 horas para guía de reciclaje

    # Simulador
    sim_tick_seconds: int = 10
    sim_eta_alert_minutes: int = 10

    class Config:
        env_file = ".env"
        extra = "allow"  # Permitir variables extras del .env


settings = Settings()