//! Comprehensive test suite: Run all load tests sequentially

use anyhow::Result;
use std::time::Duration;

pub async fn run(url: &str) -> Result<crate::metrics::LoadTestReport> {
    tracing::info!("Starting Comprehensive Throughput Validation Suite");

    let mut all_reports = Vec::new();

    // Test 1: Sustained load
    tracing::info!("Test 1/4: Sustained Load");
    let report1 = super::sustained_load::run(url).await?;
    all_reports.push(report1);

    tokio::time::sleep(Duration::from_secs(5)).await;

    // Test 2: Peak burst
    tracing::info!("Test 2/4: Peak Burst");
    let report2 = super::burst_load::run(url).await?;
    all_reports.push(report2);

    tokio::time::sleep(Duration::from_secs(5)).await;

    // Test 3: Market data streaming
    tracing::info!("Test 3/4: Market Data Streaming");
    let report3 = super::streaming_load::run(url).await?;
    all_reports.push(report3);

    tokio::time::sleep(Duration::from_secs(5)).await;

    // Test 4: Connection pool
    tracing::info!("Test 4/4: Connection Pool Saturation");
    let report4 = super::pool_saturation::run(url).await?;
    all_reports.push(report4);

    // Aggregate report
    let mut final_report = crate::metrics::LoadTestReport::new("Comprehensive Suite");
    for report in &all_reports {
        final_report.merge(report);
    }

    Ok(final_report)
}
