use libmacchina::traits::{BatteryReadout, BatteryState, GeneralReadout, KernelReadout, MemoryReadout, ShellFormat};

fn main() {
    let battery_readout = libmacchina::BatteryReadout::new();

    let percentage = battery_readout.percentage();
    let state = battery_readout.status();

    println!("{}", percentage.unwrap());
    println!("{:?}", match state {
        Err(e) => format!("Error: {:?}", e),
        Ok(BatteryState::Charging) => "Charging".into(),
        Ok(BatteryState::Discharging) => "Discharging".into(),
    });

    let general_readout = libmacchina::GeneralReadout::new();
    println!("User name: {}", general_readout.username().unwrap());
    println!("IP: {}", general_readout.local_ip().unwrap());
    println!("Hostname: {}", general_readout.hostname().unwrap());
    println!("CPU model name: {}", general_readout.cpu_model_name().unwrap());
    println!("CPU phy cores: {}", general_readout.cpu_physical_cores().unwrap());
    println!("CPU cores: {}", general_readout.cpu_cores().unwrap());
    println!("CPU usage: {}", general_readout.cpu_usage().unwrap());
    println!("Uptime: {}", general_readout.uptime().unwrap());
    println!("OS name: {}", general_readout.os_name().unwrap());
    println!("Machine: {}", general_readout.machine().unwrap());
    println!("Window manager: {}", general_readout.window_manager().unwrap());
    println!("Terminal: {}", general_readout.terminal().unwrap());
    println!("Shell: {}", general_readout.shell(ShellFormat::Absolute).unwrap());
    println!("Shell: {}", general_readout.shell(ShellFormat::Relative).unwrap());

    let kernel_readout = libmacchina::KernelReadout::new();
    println!("OS release: {}", kernel_readout.os_release().unwrap());
    println!("OS type: {}", kernel_readout.os_type().unwrap());
    println!("Pretty kernel: {}", kernel_readout.pretty_kernel().unwrap());

    // let product_readout = libmacchina::ProductReadout::new();
    // println!("{}",product_readout.product().unwrap());
    // println!("{}",product_readout.name().unwrap());
    // println!("{}",product_readout.version().unwrap());

    let memory_readout = libmacchina::MemoryReadout::new();
    println!("Memory total: {}", memory_readout.total().unwrap());
    println!("Memory used: {}", memory_readout.used().unwrap());
    println!("Memory free: {}", memory_readout.free().unwrap());
}
