# coding: utf-8


"""
IGNORE:
    Nutanix Security APIs

    Manage security features, such as encryption, certificates, or platform hardening.  # noqa: E501

    OpenAPI spec version: 4.0.1
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
IGNORE
"""
import pprint
import json
import ast
import re  # noqa: F401

import six
from pathlib import Path
from ntnx_security_py_client.models.common.v1.response.ApiLink import ApiLink  # noqa: F401,E501
from ntnx_security_py_client.models.common.v1.response.ExternalizableAbstractModel import ExternalizableAbstractModel  # noqa: F401,E501
from ntnx_security_py_client.models.security.v4.report.Severity import Severity  # noqa: F401,E501

class Vulnerability(ExternalizableAbstractModel):

    """Contains all relevant information for a vulnerability

    :param cesa_id: (:attr:`cesa_id`) The CESA id
    :type cesa_id: 
     max=199 chars
    
    :param cve_ids: (:attr:`cve_ids`) The CVE ids associated with this CESA
    :type cve_ids: 
    
    
    :param is_critical: (:attr:`is_critical`) If the vulnerability is critical or not
    :type is_critical: 
    
    
    :param description: (:attr:`description`) The short description of the vulnerability
    :type description: 
     max=499 chars
    
    :param fix_versions: (:attr:`fix_versions`) The AOS versions where the vulnerability was fixed
    :type fix_versions: 
    
    
    :param severity: (:attr:`severity`) 
    :type severity: 
    
    
    :param nxvd_version: (:attr:`nxvd_version`) Version of NXVD data used to calculate vulnerabilities
    :type nxvd_version: 
     max=199 chars
    
    :param nxvd_created_time: (:attr:`nxvd_created_time`) Date of creation of NXVD data used to calculate vulnerabilities
    :type nxvd_created_time: 
    
    

    """
    """
    IGNORE:
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    IGNORE
    """  # noqa: E501
    swagger_types = {
        'cesa_id': 'str',
        'cve_ids': 'list[str]',
        'is_critical': 'bool',
        'description': 'str',
        'fix_versions': 'list[str]',
        'severity': 'security.v4.report.Severity',
        'nxvd_version': 'str',
        'nxvd_created_time': 'datetime',
        'ext_id': 'str',
        'links': 'list[common.v1.response.ApiLink]',
        'tenant_id': 'str',
        '_reserved': 'dict(str, object)',
        '_object_type': 'str',
        '_unknown_fields': 'dict(str, object)',
    }

    attribute_map = {
        'cesa_id': 'cesaId',
        'cve_ids': 'cveIds',
        'is_critical': 'isCritical',
        'description': 'description',
        'fix_versions': 'fixVersions',
        'severity': 'severity',
        'nxvd_version': 'nxvdVersion',
        'nxvd_created_time': 'nxvdCreatedTime',
        'ext_id': 'extId',
        'links': 'links',
        'tenant_id': 'tenantId',
        '_reserved': '$reserved',
        '_object_type': '$objectType',
        '_unknown_fields': '$unknownFields',
    }



    def __init__(self, cesa_id=None, cve_ids=None, is_critical=None, description=None, fix_versions=None, severity=None, nxvd_version=None, nxvd_created_time=None, ext_id=None, links=None, tenant_id=None, *args, **kwargs):  # noqa: E501
        ExternalizableAbstractModel.__init__(self, ext_id, links, tenant_id, *args, **kwargs)
        self.__cesa_id = None
        self.__cve_ids = None
        self.__is_critical = None
        self.__description = None
        self.__fix_versions = None
        self.__severity = None
        self.__nxvd_version = None
        self.__nxvd_created_time = None
        self.discriminator = None
        if cesa_id is not None:
            self.__cesa_id = cesa_id
        if cve_ids is not None:
            self.__cve_ids = cve_ids
        if is_critical is not None:
            self.__is_critical = is_critical
        if description is not None:
            self.__description = description
        if fix_versions is not None:
            self.__fix_versions = fix_versions
        if severity is not None:
            self.__severity = severity
        if nxvd_version is not None:
            self.__nxvd_version = nxvd_version
        if nxvd_created_time is not None:
            self.__nxvd_created_time = nxvd_created_time

    def _initialize_object_type(self):
        return 'security.v4.report.Vulnerability'

    def _initialize_object_version(self):
        return 'v4.r0'


    @property
    def cesa_id(self):
        """
        The CESA id

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__cesa_id

    @cesa_id.setter
    def cesa_id(self, cesa_id):
        if cesa_id is not None and len(cesa_id) > 199:
            raise ValueError("Invalid value for `cesa_id`, length must be less than or equal to `199`")  # noqa: E501

        self.__cesa_id = cesa_id

    @property
    def cve_ids(self):
        """
        The CVE ids associated with this CESA

        :type:
            list[ :class:`~str` ]
        """  # noqa: E501
        return self.__cve_ids

    @cve_ids.setter
    def cve_ids(self, cve_ids):

        self.__cve_ids = cve_ids

    @property
    def is_critical(self):
        """
        If the vulnerability is critical or not

        :type:
                :class:`~bool`
        """  # noqa: E501
        return self.__is_critical

    @is_critical.setter
    def is_critical(self, is_critical):

        self.__is_critical = is_critical

    @property
    def description(self):
        """
        The short description of the vulnerability

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__description

    @description.setter
    def description(self, description):
        if description is not None and len(description) > 499:
            raise ValueError("Invalid value for `description`, length must be less than or equal to `499`")  # noqa: E501

        self.__description = description

    @property
    def fix_versions(self):
        """
        The AOS versions where the vulnerability was fixed

        :type:
            list[ :class:`~str` ]
        """  # noqa: E501
        return self.__fix_versions

    @fix_versions.setter
    def fix_versions(self, fix_versions):

        self.__fix_versions = fix_versions

    @property
    def severity(self):
        """
        

        :type:
            :class:`~ntnx_security_py_client.models.security.v4.report.Severity`
        """  # noqa: E501
        return self.__severity

    @severity.setter
    def severity(self, severity):

        self.__severity = severity

    @property
    def nxvd_version(self):
        """
        Version of NXVD data used to calculate vulnerabilities

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__nxvd_version

    @nxvd_version.setter
    def nxvd_version(self, nxvd_version):
        if nxvd_version is not None and len(nxvd_version) > 199:
            raise ValueError("Invalid value for `nxvd_version`, length must be less than or equal to `199`")  # noqa: E501

        self.__nxvd_version = nxvd_version

    @property
    def nxvd_created_time(self):
        """
        Date of creation of NXVD data used to calculate vulnerabilities

        :type:
                :class:`~datetime`
        """  # noqa: E501
        return self.__nxvd_created_time

    @nxvd_created_time.setter
    def nxvd_created_time(self, nxvd_created_time):

        self.__nxvd_created_time = nxvd_created_time

    def _to_dict(self, sanitize):
        """Returns the model properties as a dict. Omits None properties based on the provided "sanitize" parameter.

        :param sanitize: A flag to omit None properties if set to True
        :type sanitize: bool
        """

        result = {}
        for attr, attr_type in six.iteritems(self.swagger_types):

            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x._to_dict(sanitize) if hasattr(x, "_to_dict") else x,
                    value
                ))
            elif hasattr(value, "_to_dict"):
                result[attr] = value._to_dict(sanitize)
            elif isinstance(value, Path):
                result[attr] = str(value)
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1]._to_dict(sanitize)) if hasattr(item[1], "_to_dict")
                    else (
                        (item[0], str(item[1])) if item[0] == 'path' and '$objectType' in value and value['$objectType'] == 'pathlib.Path'
                        else item
                    ),
                    six.iteritems(value)
                ))
            else:
                if sanitize:
                    if value is not None:
                        result[attr] = value
                else:
                    result[attr] = value
        if issubclass(Vulnerability, dict):
            for key, value in six.iteritems(self):
                result[key] = value

        return result

    def to_dict(self):
        """Returns the model properties as a dictionary"""
        return self._to_dict(False)

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self._to_dict(True))

    def __repr__(self):
        """For `print` and `pprint`"""
        return self.to_str()

    def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, Vulnerability):
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        return not self == other

