# coding: utf-8

"""
    Defect Dojo API

    To use the API you need be authorized.  # noqa: E501

    The version of the OpenAPI document: v2
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six


class FindingTemplate(object):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    """
    Attributes:
      openapi_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.
    """
    openapi_types = {
        'id': 'int',
        'title': 'str',
        'cwe': 'int',
        'cve': 'str',
        'severity': 'str',
        'description': 'str',
        'mitigation': 'str',
        'impact': 'str',
        'references': 'str',
        'last_used': 'datetime',
        'numerical_severity': 'str',
        'template_match': 'bool',
        'template_match_title': 'bool'
    }

    attribute_map = {
        'id': 'id',
        'title': 'title',
        'cwe': 'cwe',
        'cve': 'cve',
        'severity': 'severity',
        'description': 'description',
        'mitigation': 'mitigation',
        'impact': 'impact',
        'references': 'references',
        'last_used': 'last_used',
        'numerical_severity': 'numerical_severity',
        'template_match': 'template_match',
        'template_match_title': 'template_match_title'
    }

    def __init__(self, id=None, title=None, cwe=None, cve=None, severity=None, description=None, mitigation=None, impact=None, references=None, last_used=None, numerical_severity=None, template_match=None, template_match_title=None):  # noqa: E501
        """FindingTemplate - a model defined in OpenAPI"""  # noqa: E501

        self._id = None
        self._title = None
        self._cwe = None
        self._cve = None
        self._severity = None
        self._description = None
        self._mitigation = None
        self._impact = None
        self._references = None
        self._last_used = None
        self._numerical_severity = None
        self._template_match = None
        self._template_match_title = None
        self.discriminator = None

        if id is not None:
            self.id = id
        self.title = title
        self.cwe = cwe
        self.cve = cve
        self.severity = severity
        self.description = description
        self.mitigation = mitigation
        self.impact = impact
        self.references = references
        if last_used is not None:
            self.last_used = last_used
        if numerical_severity is not None:
            self.numerical_severity = numerical_severity
        if template_match is not None:
            self.template_match = template_match
        if template_match_title is not None:
            self.template_match_title = template_match_title

    @property
    def id(self):
        """Gets the id of this FindingTemplate.  # noqa: E501


        :return: The id of this FindingTemplate.  # noqa: E501
        :rtype: int
        """
        return self._id

    @id.setter
    def id(self, id):
        """Sets the id of this FindingTemplate.


        :param id: The id of this FindingTemplate.  # noqa: E501
        :type: int
        """

        self._id = id

    @property
    def title(self):
        """Gets the title of this FindingTemplate.  # noqa: E501


        :return: The title of this FindingTemplate.  # noqa: E501
        :rtype: str
        """
        return self._title

    @title.setter
    def title(self, title):
        """Sets the title of this FindingTemplate.


        :param title: The title of this FindingTemplate.  # noqa: E501
        :type: str
        """
        if title is None:
            raise ValueError("Invalid value for `title`, must not be `None`")  # noqa: E501
        if title is not None and len(title) > 1000:
            raise ValueError("Invalid value for `title`, length must be less than or equal to `1000`")  # noqa: E501
        if title is not None and len(title) < 1:
            raise ValueError("Invalid value for `title`, length must be greater than or equal to `1`")  # noqa: E501

        self._title = title

    @property
    def cwe(self):
        """Gets the cwe of this FindingTemplate.  # noqa: E501


        :return: The cwe of this FindingTemplate.  # noqa: E501
        :rtype: int
        """
        return self._cwe

    @cwe.setter
    def cwe(self, cwe):
        """Sets the cwe of this FindingTemplate.


        :param cwe: The cwe of this FindingTemplate.  # noqa: E501
        :type: int
        """
        if cwe is not None and cwe > 2147483647:  # noqa: E501
            raise ValueError("Invalid value for `cwe`, must be a value less than or equal to `2147483647`")  # noqa: E501
        if cwe is not None and cwe < -2147483648:  # noqa: E501
            raise ValueError("Invalid value for `cwe`, must be a value greater than or equal to `-2147483648`")  # noqa: E501

        self._cwe = cwe

    @property
    def cve(self):
        """Gets the cve of this FindingTemplate.  # noqa: E501


        :return: The cve of this FindingTemplate.  # noqa: E501
        :rtype: str
        """
        return self._cve

    @cve.setter
    def cve(self, cve):
        """Sets the cve of this FindingTemplate.


        :param cve: The cve of this FindingTemplate.  # noqa: E501
        :type: str
        """
        if cve is not None and len(cve) > 20:
            raise ValueError("Invalid value for `cve`, length must be less than or equal to `20`")  # noqa: E501
        if cve is not None and len(cve) < 1:
            raise ValueError("Invalid value for `cve`, length must be greater than or equal to `1`")  # noqa: E501
        if cve is not None and not re.search(r'^CVE-\d{4}-\d{4,7}$', cve):  # noqa: E501
            raise ValueError(r"Invalid value for `cve`, must be a follow pattern or equal to `/^CVE-\d{4}-\d{4,7}$/`")  # noqa: E501

        self._cve = cve

    @property
    def severity(self):
        """Gets the severity of this FindingTemplate.  # noqa: E501


        :return: The severity of this FindingTemplate.  # noqa: E501
        :rtype: str
        """
        return self._severity

    @severity.setter
    def severity(self, severity):
        """Sets the severity of this FindingTemplate.


        :param severity: The severity of this FindingTemplate.  # noqa: E501
        :type: str
        """
        if severity is not None and len(severity) > 200:
            raise ValueError("Invalid value for `severity`, length must be less than or equal to `200`")  # noqa: E501

        self._severity = severity

    @property
    def description(self):
        """Gets the description of this FindingTemplate.  # noqa: E501


        :return: The description of this FindingTemplate.  # noqa: E501
        :rtype: str
        """
        return self._description

    @description.setter
    def description(self, description):
        """Sets the description of this FindingTemplate.


        :param description: The description of this FindingTemplate.  # noqa: E501
        :type: str
        """

        self._description = description

    @property
    def mitigation(self):
        """Gets the mitigation of this FindingTemplate.  # noqa: E501


        :return: The mitigation of this FindingTemplate.  # noqa: E501
        :rtype: str
        """
        return self._mitigation

    @mitigation.setter
    def mitigation(self, mitigation):
        """Sets the mitigation of this FindingTemplate.


        :param mitigation: The mitigation of this FindingTemplate.  # noqa: E501
        :type: str
        """

        self._mitigation = mitigation

    @property
    def impact(self):
        """Gets the impact of this FindingTemplate.  # noqa: E501


        :return: The impact of this FindingTemplate.  # noqa: E501
        :rtype: str
        """
        return self._impact

    @impact.setter
    def impact(self, impact):
        """Sets the impact of this FindingTemplate.


        :param impact: The impact of this FindingTemplate.  # noqa: E501
        :type: str
        """

        self._impact = impact

    @property
    def references(self):
        """Gets the references of this FindingTemplate.  # noqa: E501


        :return: The references of this FindingTemplate.  # noqa: E501
        :rtype: str
        """
        return self._references

    @references.setter
    def references(self, references):
        """Sets the references of this FindingTemplate.


        :param references: The references of this FindingTemplate.  # noqa: E501
        :type: str
        """

        self._references = references

    @property
    def last_used(self):
        """Gets the last_used of this FindingTemplate.  # noqa: E501


        :return: The last_used of this FindingTemplate.  # noqa: E501
        :rtype: datetime
        """
        return self._last_used

    @last_used.setter
    def last_used(self, last_used):
        """Sets the last_used of this FindingTemplate.


        :param last_used: The last_used of this FindingTemplate.  # noqa: E501
        :type: datetime
        """

        self._last_used = last_used

    @property
    def numerical_severity(self):
        """Gets the numerical_severity of this FindingTemplate.  # noqa: E501


        :return: The numerical_severity of this FindingTemplate.  # noqa: E501
        :rtype: str
        """
        return self._numerical_severity

    @numerical_severity.setter
    def numerical_severity(self, numerical_severity):
        """Sets the numerical_severity of this FindingTemplate.


        :param numerical_severity: The numerical_severity of this FindingTemplate.  # noqa: E501
        :type: str
        """
        if numerical_severity is not None and len(numerical_severity) < 1:
            raise ValueError("Invalid value for `numerical_severity`, length must be greater than or equal to `1`")  # noqa: E501

        self._numerical_severity = numerical_severity

    @property
    def template_match(self):
        """Gets the template_match of this FindingTemplate.  # noqa: E501

        Enables this template for matching remediation advice. Match will be applied to all active, verified findings by CWE.  # noqa: E501

        :return: The template_match of this FindingTemplate.  # noqa: E501
        :rtype: bool
        """
        return self._template_match

    @template_match.setter
    def template_match(self, template_match):
        """Sets the template_match of this FindingTemplate.

        Enables this template for matching remediation advice. Match will be applied to all active, verified findings by CWE.  # noqa: E501

        :param template_match: The template_match of this FindingTemplate.  # noqa: E501
        :type: bool
        """

        self._template_match = template_match

    @property
    def template_match_title(self):
        """Gets the template_match_title of this FindingTemplate.  # noqa: E501

        Matches by title text (contains search) and CWE.  # noqa: E501

        :return: The template_match_title of this FindingTemplate.  # noqa: E501
        :rtype: bool
        """
        return self._template_match_title

    @template_match_title.setter
    def template_match_title(self, template_match_title):
        """Sets the template_match_title of this FindingTemplate.

        Matches by title text (contains search) and CWE.  # noqa: E501

        :param template_match_title: The template_match_title of this FindingTemplate.  # noqa: E501
        :type: bool
        """

        self._template_match_title = template_match_title

    def to_dict(self):
        """Returns the model properties as a dict"""
        result = {}

        for attr, _ in six.iteritems(self.openapi_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

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

    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, FindingTemplate):
            return False

        return self.__dict__ == other.__dict__

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