//! Basic usage example for Hospital Helpers library

use hh::{
    client::HHClient,
    diagnosis::{DiagnosisService, Symptom, SeverityLevel},
    medicine::{MedicineQuery, MedicineService},
};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    println!("=== Hospital Helpers Basic Example ===\n");

    // Create HTTP client
    let client = HHClient::new();

    // Example 1: Medicine Service
    println!("--- Medicine Information ---");
    let medicine_service = MedicineService::new(client.clone());
    
    let query = MedicineQuery::new("阿司匹林");
    let results = medicine_service.search(&query).await?;
    
    println!("Search results for '阿司匹林':");
    for medicine in results {
        println!("  Name: {}", medicine.name);
        if let Some(desc) = &medicine.description {
            println!("  Description: {}", desc);
        }
    }

    // Example 2: Diagnosis Service
    println!("\n--- Symptom Analysis ---");
    let diagnosis_service = DiagnosisService::new(client);
    
    let symptoms = vec![
        Symptom::new("发烧", SeverityLevel::Moderate).with_duration(2),
        Symptom::new("咳嗽", SeverityLevel::Mild).with_duration(3),
        Symptom::new("头痛", SeverityLevel::Mild),
    ];
    
    println!("Analyzing symptoms:");
    for symptom in &symptoms {
        println!("  - {} ({:?})", symptom.name, symptom.severity);
    }
    
    let diagnosis = diagnosis_service.analyze_symptoms(&symptoms).await?;
    
    println!("\nRecommendations:");
    for rec in &diagnosis.recommendations {
        println!("  • {}", rec);
    }
    
    if diagnosis.needs_immediate_attention {
        println!("\n⚠️  WARNING: Immediate medical attention may be needed!");
    }

    println!("\n=== Example Complete ===");
    Ok(())
}
