#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

# Example output:
# <<<win_system:sep(58)>>>
# Manufacturer : Oracle Corporation
# Name         : Computergehäuse
# Model        :
# HotSwappable :
# InstallDate  :
# PartNumber   :
# SerialNumber :


def inv_win_system(info):
    node = inv_tree("hardware.system.")
    for line in info:
        if len(line) > 2:
            line = [line[0], ":".join(line[1:])]
        varname, value = line
        varname = re.sub(" *", "", varname)
        value = re.sub("^ ", "", value)
        if varname == "SerialNumber":
            node["serial"] = value
        elif varname == "Manufacturer":
            node["manufacturer"] = value
        elif varname == "Name":
            node["product"] = value
        elif varname == "Model":
            node["family"] = value


inv_info["win_system"] = {
    "inv_function": inv_win_system,
}
