mod api;
use std::env;
use dotenv::dotenv;
fn info() -> &'static str {
"lib_vtop v0.1.0"
}
#[tokio::main]
async fn main() {
dotenv().ok();
env_logger::init();
println!("=== lib_vtop Dry Run Demo ===");
println!("Library: {}", info());
let greeting = api::simple::greet("Dry Run User".to_string());
println!("Greeting: {}", greeting);
let username = env::var("VTOP_USERNAME").unwrap_or_else(|_| "demo_user".to_string());
let password = env::var("VTOP_PASSWORD").unwrap_or_else(|_| "demo_pass".to_string());
println!("\n=== VTOP Client Demo ===");
println!("Username: {}", username);
let mut client = api::vtop_get_client::get_vtop_client(username, password);
println!(
"VTOP client created. Authenticated: {:?}",
client.is_authenticated()
);
if env::var("VTOP_USERNAME").is_ok() && env::var("VTOP_PASSWORD").is_ok() {
println!("Attempting real login...");
match api::vtop_get_client::vtop_client_login(&mut client).await {
Ok(_) => println!("✅ VTOP login successful"),
Err(e) => println!("❌ VTOP login failed: {:?}", e),
}
match api::vtop_get_client::fetch_attendance(&mut client, "AP2024258".to_string()).await {
Ok(result) => println!("Attendance: {:?}", result),
Err(e) => println!("❌ VTOP login failed: {:?}", e),
}
} else {
println!("ℹ️ No real credentials provided. Use VTOP_USERNAME and VTOP_PASSWORD env vars for real testing.");
}
println!("\n=== Dry Run Complete ===");
}