from . import cpu, gpu, usb, network, mobo, memory, disk

usb_devs = usb.get()
cpu_info = cpu.get()
gpu_info = gpu.get()
net_dev = network.get()
mobo_info = mobo.get()
disk_info = disk.get()


def get():
    info = {
        "usb": [],
        "cpu": {},
        "gpu": [],
        "net": {},
        "mobo": {},
        "disk": [],
        "mem": {"size": "kb"},
    }
    for dev in usb_devs:
        info["usb"].append(dev)

    info["cpu"]["model"] = cpu_info.model
    info["cpu"]["vendor"] = cpu_info.vendor
    info["cpu"]["core_no"] = cpu_info.core_no
    info["cpu"]["thread_no"] = cpu_info.thread_no
    info["cpu"]["microcode"] = cpu_info.microcode
    info["cpu"]["generation"] = cpu_info.generation

    for gpu in gpu_info:
        tmp_info = {}
        tmp_info["vendor"] = gpu.vendor
        tmp_info["device"] = gpu.device
        tmp_info["driver"] = gpu.driver
        tmp_info["vendor_id"] = gpu.vendor_id
        tmp_info["device_id"] = gpu.device_id

        info["gpu"].append(tmp_info)

    info["net"]["mac"] = net_dev.mac
    info["net"]["interface"] = net_dev.interface

    info["mobo"]["name"] = mobo_info.name
    info["mobo"]["vendor"] = mobo_info.vendor
    info["mobo"]["version"] = mobo_info.version

    for dev in disk_info:
        tmp_info = {}
        tmp_info["model"] = dev.model
        tmp_info["serial"] = dev.serial
        tmp_info["size"] = dev.size
        tmp_info["firmware_rev"] = dev.firmware_rev
        info["disk"].append(tmp_info)
    info["mem"]["total"] = memory.get()

    return info
