use std::thread;

use wmi::{COMLibrary, WMIConnection};

use crate::dtos::gpu::{GpuInfo, Win32_VideoController};



// todo
pub fn get_gpu_info() -> Vec<GpuInfo> {
	let gpus = thread::spawn(|| {
		let wmi_con = WMIConnection::new(COMLibrary::new().unwrap()).unwrap();

		let results: Vec<Win32_VideoController> = wmi_con.query().unwrap();

		results.into_iter().map(|video_controller| {
            GpuInfo {
                name: video_controller.Name,
                virtual_ram: video_controller.AdapterRAM,
            }
        }).collect::<Vec<GpuInfo>>()
	})
		.join()
		.unwrap();

	println!("{:#?}", gpus);
	gpus
}
