use text_video_agent_client::apis::configuration::Configuration;
use text_video_agent_client::apis::{default_api, midjourney_api, llm_api};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // 创建支持 HTTPS 的客户端
    let client = reqwest::Client::builder()
        .timeout(std::time::Duration::from_secs(30))
        .build()?;

    // 创建配置
    let config = Configuration {
        base_path: "https://bowongai-dev--text-video-agent-fastapi-app.modal.run".to_string(),
        user_agent: Some("text-video-agent-rust-client/1.0.6".to_string()),
        client,
        basic_auth: None,
        oauth_access_token: None,
        bearer_access_token: None,
        api_key: None,
    };

    println!("🚀 文本视频智能体 API 健康检查");
    println!("================================");
    println!("API 地址: {}", config.base_path);
    println!();

    // 1. 测试根路径
    println!("📍 测试根路径...");
    match default_api::root_get(&config).await {
        Ok(response) => {
            println!("✅ 根路径响应: {}", response);
        }
        Err(e) => {
            println!("❌ 根路径错误: {:?}", e);
        }
    }
    println!();

    // 2. 测试 Midjourney 健康检查
    println!("🎨 测试 Midjourney 健康检查...");
    match midjourney_api::health_check_api_mj_health_get(&config).await {
        Ok(response) => {
            println!("✅ Midjourney 健康状态: {}", response);
        }
        Err(e) => {
            println!("❌ Midjourney 健康检查错误: {:?}", e);
        }
    }
    println!();

    // 3. 测试获取支持的 LLM 模型
    println!("🧠 获取支持的 LLM 模型...");
    match llm_api::llm_supported_models(&config).await {
        Ok(response) => {
            println!("✅ 支持的模型: {}", response);
        }
        Err(e) => {
            println!("❌ 获取模型列表错误: {:?}", e);
        }
    }
    println!();

    println!("🎯 健康检查完成！");
    Ok(())
}
