use std::thread;
use wmi::{COMLibrary, WMIConnection};
use crate::dtos::motherboard::{MotherboardInfo, Win32_BaseBoard};

pub fn get_motherboard_info() -> MotherboardInfo {
	let motherboard = thread::spawn(|| {
		let wmi_con = WMIConnection::new(COMLibrary::new().unwrap()).unwrap();

		let results: Vec<Win32_BaseBoard> = wmi_con.query().unwrap();
		let win32_motherboard = results.first().unwrap();

		MotherboardInfo {
			serial_number: win32_motherboard.SerialNumber.clone(),
			manufacturer: win32_motherboard.Manufacturer.clone(),
		}
	})
		.join()
		.unwrap();

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