//! Order routing logic

use super::config::RoutingConfig;
use super::error::Result;
use common::{BrokerType, Order};

/// Routing decision
#[derive(Debug, Clone)]
/// RoutingDecision
///
/// Auto-generated documentation placeholder - enhance with specifics
pub struct RoutingDecision {
    /// Broker
    pub broker: BrokerType,
    /// Reason
    pub reason: String,
}

/// Order router
#[derive(Debug)]
/// OrderRouter
///
/// Auto-generated documentation placeholder - enhance with specifics
pub struct OrderRouter {
    config: RoutingConfig,
}

impl OrderRouter {
    /// Create new router
    pub const fn new(config: RoutingConfig) -> Self {
        Self { config }
    }

    /// Route an order to appropriate broker
    pub async fn route_order(&self, _order: &Order) -> Result<RoutingDecision> {
        // Simple routing logic - use default broker
        let broker = match self.config.default_broker.as_str() {
            "InteractiveBrokers" => BrokerType::InteractiveBrokers,
            "ICMarkets" => BrokerType::ICMarkets,
            _ => BrokerType::InteractiveBrokers,
        };

        Ok(RoutingDecision {
            broker,
            reason: "Default routing".to_owned(),
        })
    }
}
