use alloy::primitives::Address;
use std::collections::HashMap;

/// Configuration for the collector bootstrap.
///
/// Decoupled from any application-specific config so every project
/// can map its own config into this struct.
pub struct CollectorConfig {
    pub start_block: u64,
    pub max_blocks_per_batch: u64,
    pub use_pending_blocks: bool,
    pub use_websocket: bool,
    pub websocket_urls: Vec<String>,
    /// Polling interval in milliseconds for LatestBlock mode.
    pub wait_time: u64,
    /// If true, after each event batch the collector will multicall `fee()` on
    /// every tracked Algebra V3 pool (variant `V3PoolType::AlgebraV3`) and
    /// write the fresh fee back into the registry. Use for chains where the
    /// Algebra fee plugin updates fees per-block without emitting events.
    pub refetch_algebra_fee: bool,
}

/// Configuration for batch pool fetching from RPC.
pub struct PoolFetchConfig {
    /// Multicall3 address override. If None, falls back to chain-specific
    /// custom address, then standard MULTICALL3 (0xcA11bde05977b3631167028862bE2a173976CA11).
    pub multicall_address: Option<Address>,
    pub chain_id: u64,
    /// Factory address (hex, any case) -> fee in 1_000_000 basis. Used for V2 pools.
    pub factory_to_fee: HashMap<String, u64>,
    /// Aerodrome-style factory addresses (for stable/volatile detection).
    pub aero_factory_addresses: Vec<Address>,
    /// Number of pools to fetch in parallel per chunk (default: 10).
    pub chunk_size: usize,
    /// Milliseconds to wait between chunks (rate limiting).
    pub wait_time_between_chunks: u64,
    /// Max retry attempts per pool with exponential backoff (default: 5).
    pub max_retries: u32,
    /// Whether to fetch pools within each chunk in parallel (default: true).
    /// Set to false for rate-limited RPCs to fetch pools sequentially.
    pub parallel_fetch: bool,
}
