from typing import List
from dataclasses import dataclass


@dataclass
class Config:
    """Configuration for P2P Liquidity Monitor"""
    
    # Assets to monitor
    ASSETS: List[str] = None
    
    # Fiat currency
    FIAT: str = "USD"
    
    # Trade types to monitor
    TRADE_TYPES: List[str] = None
    
    # Polling interval in seconds
    POLL_INTERVAL: int = 30
    
    # D variable expiration time in minutes
    D_VARIABLE_EXPIRY_MINUTES: int = 60
    
    @property
    def D_VARIABLE_TIMEOUT(self) -> int:
        """D variable timeout in seconds"""
        return self.D_VARIABLE_EXPIRY_MINUTES * 60
    
    # Minimum amount change to trigger event (to filter noise)
    MIN_AMOUNT_CHANGE: float = 0.01
    
    # API rate limiting
    MAX_REQUESTS_PER_MINUTE: int = 60
    
    # Logging configuration
    LOG_LEVEL: str = "INFO"
    LOG_FILE: str = "liquidity_monitor.log"
    LOG_RETENTION_DAYS: int = 7
    
    # Proxy configuration (optional)
    PROXY_URL: str = None  # Format: 'login:password@ip:port' or 'ip:port'
    PROXY_TYPE: str = "http"  # http, https, socks5
    
    def __post_init__(self):
        if self.ASSETS is None:
            self.ASSETS = ["USDT", "USDC", "BTC", "ETH"]
        
        if self.TRADE_TYPES is None:
            self.TRADE_TYPES = ["SELL", "BUY"]


# Default configuration
DEFAULT_CONFIG = Config(
    ASSETS=["USDT", "USDC", "BTC", "ETH"],  # All major assets
    FIAT="USD",  # USD has most active trading
    POLL_INTERVAL=30,
    D_VARIABLE_EXPIRY_MINUTES=60,
    MIN_AMOUNT_CHANGE=1.0,  # 1 USDT minimum change
    LOG_LEVEL="INFO",
    PROXY_URL=None,  # No proxy by default
    PROXY_TYPE="http"
) 