use std::path::PathBuf;

use iknowyou_engine::run_pg1_eval;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let data_dir = std::env::args()
        .nth(1)
        .map(PathBuf::from)
        .unwrap_or_else(|| std::env::temp_dir().join("iknowyou_pg1_eval"));

    let metrics = run_pg1_eval(&data_dir)?;

    println!("PG1 metrics");
    println!("data_dir: {}", data_dir.display());
    println!(
        "hard_negative_leak_rate: {:.6}",
        metrics.hard_negative_leak_rate
    );
    println!("adaptation_p95_ms: {}", metrics.adaptation_p95_ms);
    println!("useful_item_uplift: {:.6}", metrics.useful_item_uplift);
    println!(
        "repeated_unwanted_rate: {:.6}",
        metrics.repeated_unwanted_rate
    );
    println!(
        "total_refreshes_checked: {}",
        metrics.total_refreshes_checked
    );

    Ok(())
}
