use smbioslib::SMBiosBaseboardInformation;
use smbioslib::table_load_from_device;
use smbioslib::SMBiosString;

use crate::dtos::motherboard::MotherboardInfo;

pub fn get_motherboard_info() ->MotherboardInfo {
	let data = table_load_from_device().unwrap();

	let mut manufacturer:Option<SMBiosString> = None;

	  let mut serial_number:Option<SMBiosString> = None;

	for device in data.collect::<SMBiosBaseboardInformation>() {
	  manufacturer = Some(device.manufacturer());
	  serial_number = Some(device.serial_number());
	}

	MotherboardInfo {
		serial_number: serial_number.unwrap().to_string(),
		manufacturer: manufacturer.unwrap().to_string()
	}
}
