from pydantic_settings import BaseSettings
from typing import List


class Settings(BaseSettings):
    # Application
    APP_NAME: str = "Gold Trading Simulator API"
    APP_VERSION: str = "1.0.0"
    APP_ENV: str = "development"
    DEBUG: bool = True

    # Database
    DATABASE_URL: str = "postgresql://postgres:postgres@localhost:5432/gold_trading_db"

    # API Keys (all optional now - using simulated data)
    ALPHA_VANTAGE_API_KEY: str = ""  # Optional - not needed for simulator
    OPENROUTER_API_KEY: str = ""  # Optional - for AI features only
    FINNHUB_API_KEY: str = ""  # Optional
    NEWS_API_KEY: str = ""  # Optional

    # CORS
    CORS_ORIGINS: List[str] = ["http://localhost:3000", "http://127.0.0.1:3000"]

    # Server
    HOST: str = "0.0.0.0"
    PORT: int = 8000

    # OpenRouter
    OPENROUTER_BASE_URL: str = "https://openrouter.ai/api/v1"
    OPENROUTER_MODEL: str = "anthropic/claude-3.5-sonnet"
    OPENROUTER_SITE_URL: str = "https://gold-trading-simulator.local"
    OPENROUTER_SITE_NAME: str = "Gold Trading Simulator"

    # Alpha Vantage
    ALPHA_VANTAGE_BASE_URL: str = "https://www.alphavantage.co/query"

    # News APIs
    FINNHUB_BASE_URL: str = "https://finnhub.io/api/v1"
    NEWS_API_BASE_URL: str = "https://newsapi.org/v2"

    # Alert Settings
    PRICE_ALERT_THRESHOLD: float = 1.0  # Percentage change for alerts
    NEWS_REFRESH_INTERVAL: int = 300  # Seconds (5 minutes)

    class Config:
        env_file = ".env"
        case_sensitive = True


settings = Settings()
