# -*- coding: utf-8 -*-

"""
ctddocumentation

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from ctddocumentation.api_helper import APIHelper
from ctddocumentation.models.slim_insight import SlimInsight


class AssetsWithInsights(object):

    """Implementation of the 'AssetsWithInsights' model.

    TODO: type model description here.

    Attributes:
        resource_id (string): TODO: type description here.
        id (int): TODO: type description here.
        site_id (int): TODO: type description here.
        asset_type (int): The number represents the Asset type
        asset_type___name (string): The label of the Asset type
        criticality (int): The number represent the Asset criticality
        criticality___name (string): The label of the Asset criticality
        firmware (string): The Asset firmware
        ghost (bool): Asset who has only incoming communications, i.e. asset
            that never replied
        insights (list of SlimInsight): TODO: type description here.
        i_pv_4 (list of string): The IPv4 addresses related to the Asset
        i_pv_6 (list of string): The IPv6 addresses related to the Asset
        mac (list of string): The MAC addresses that related to the Asset
        model (string): The Asset's model
        name (string): The Asset's name
        network_id (int): The Asset's network ID number
        risk_level (int): The level of the Asset's vulnerability to attacks
        site_name (string): The name of the Site that the Asset is related to
        total_cves_count (int): The total CVEs number that are related to the
            Asset
        vendor (string): the Asset's vendor

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "resource_id": 'resource_id',
        "id": 'id',
        "site_id": 'site_id',
        "asset_type": 'asset_type',
        "asset_type___name": 'asset_type__(name)',
        "criticality": 'criticality',
        "criticality___name": 'criticality__(name)',
        "firmware": 'firmware',
        "ghost": 'ghost',
        "insights": 'insights',
        "i_pv_4": 'IPv4',
        "i_pv_6": 'IPv6',
        "mac": 'mac',
        "model": 'model',
        "name": 'name',
        "network_id": 'network_id',
        "risk_level": 'risk_level',
        "site_name": 'site_name',
        "total_cves_count": 'total_cves_count',
        "vendor": 'vendor'
    }

    _optionals = [
        'resource_id',
        'id',
        'site_id',
        'asset_type',
        'asset_type___name',
        'criticality',
        'criticality___name',
        'firmware',
        'ghost',
        'insights',
        'i_pv_4',
        'i_pv_6',
        'mac',
        'model',
        'name',
        'network_id',
        'risk_level',
        'site_name',
        'total_cves_count',
        'vendor',
    ]

    def __init__(self,
                 resource_id=APIHelper.SKIP,
                 id=APIHelper.SKIP,
                 site_id=APIHelper.SKIP,
                 asset_type=APIHelper.SKIP,
                 asset_type___name=APIHelper.SKIP,
                 criticality=APIHelper.SKIP,
                 criticality___name=APIHelper.SKIP,
                 firmware=APIHelper.SKIP,
                 ghost=APIHelper.SKIP,
                 insights=APIHelper.SKIP,
                 i_pv_4=APIHelper.SKIP,
                 i_pv_6=APIHelper.SKIP,
                 mac=APIHelper.SKIP,
                 model=APIHelper.SKIP,
                 name=APIHelper.SKIP,
                 network_id=APIHelper.SKIP,
                 risk_level=APIHelper.SKIP,
                 site_name=APIHelper.SKIP,
                 total_cves_count=APIHelper.SKIP,
                 vendor=APIHelper.SKIP):
        """Constructor for the AssetsWithInsights class"""

        # Initialize members of the class
        if resource_id is not APIHelper.SKIP:
            self.resource_id = resource_id 
        if id is not APIHelper.SKIP:
            self.id = id 
        if site_id is not APIHelper.SKIP:
            self.site_id = site_id 
        if asset_type is not APIHelper.SKIP:
            self.asset_type = asset_type 
        if asset_type___name is not APIHelper.SKIP:
            self.asset_type___name = asset_type___name 
        if criticality is not APIHelper.SKIP:
            self.criticality = criticality 
        if criticality___name is not APIHelper.SKIP:
            self.criticality___name = criticality___name 
        if firmware is not APIHelper.SKIP:
            self.firmware = firmware 
        if ghost is not APIHelper.SKIP:
            self.ghost = ghost 
        if insights is not APIHelper.SKIP:
            self.insights = insights 
        if i_pv_4 is not APIHelper.SKIP:
            self.i_pv_4 = i_pv_4 
        if i_pv_6 is not APIHelper.SKIP:
            self.i_pv_6 = i_pv_6 
        if mac is not APIHelper.SKIP:
            self.mac = mac 
        if model is not APIHelper.SKIP:
            self.model = model 
        if name is not APIHelper.SKIP:
            self.name = name 
        if network_id is not APIHelper.SKIP:
            self.network_id = network_id 
        if risk_level is not APIHelper.SKIP:
            self.risk_level = risk_level 
        if site_name is not APIHelper.SKIP:
            self.site_name = site_name 
        if total_cves_count is not APIHelper.SKIP:
            self.total_cves_count = total_cves_count 
        if vendor is not APIHelper.SKIP:
            self.vendor = vendor 

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if dictionary is None:
            return None

        # Extract variables from the dictionary

        resource_id = dictionary.get("resource_id") if dictionary.get("resource_id") else APIHelper.SKIP
        id = dictionary.get("id") if dictionary.get("id") else APIHelper.SKIP
        site_id = dictionary.get("site_id") if dictionary.get("site_id") else APIHelper.SKIP
        asset_type = dictionary.get("asset_type") if dictionary.get("asset_type") else APIHelper.SKIP
        asset_type___name = dictionary.get("asset_type__(name)") if dictionary.get("asset_type__(name)") else APIHelper.SKIP
        criticality = dictionary.get("criticality") if dictionary.get("criticality") else APIHelper.SKIP
        criticality___name = dictionary.get("criticality__(name)") if dictionary.get("criticality__(name)") else APIHelper.SKIP
        firmware = dictionary.get("firmware") if dictionary.get("firmware") else APIHelper.SKIP
        ghost = dictionary.get("ghost") if "ghost" in dictionary.keys() else APIHelper.SKIP
        insights = None
        if dictionary.get('insights') is not None:
            insights = [SlimInsight.from_dictionary(x) for x in dictionary.get('insights')]
        else:
            insights = APIHelper.SKIP
        i_pv_4 = dictionary.get("IPv4") if dictionary.get("IPv4") else APIHelper.SKIP
        i_pv_6 = dictionary.get("IPv6") if dictionary.get("IPv6") else APIHelper.SKIP
        mac = dictionary.get("mac") if dictionary.get("mac") else APIHelper.SKIP
        model = dictionary.get("model") if dictionary.get("model") else APIHelper.SKIP
        name = dictionary.get("name") if dictionary.get("name") else APIHelper.SKIP
        network_id = dictionary.get("network_id") if dictionary.get("network_id") else APIHelper.SKIP
        risk_level = dictionary.get("risk_level") if dictionary.get("risk_level") else APIHelper.SKIP
        site_name = dictionary.get("site_name") if dictionary.get("site_name") else APIHelper.SKIP
        total_cves_count = dictionary.get("total_cves_count") if dictionary.get("total_cves_count") else APIHelper.SKIP
        vendor = dictionary.get("vendor") if dictionary.get("vendor") else APIHelper.SKIP
        # Return an object of this model
        return cls(resource_id,
                   id,
                   site_id,
                   asset_type,
                   asset_type___name,
                   criticality,
                   criticality___name,
                   firmware,
                   ghost,
                   insights,
                   i_pv_4,
                   i_pv_6,
                   mac,
                   model,
                   name,
                   network_id,
                   risk_level,
                   site_name,
                   total_cves_count,
                   vendor)
