# coding: utf-8

"""
    Layered Insight Assessment, Compliance, Witness & Control

    LI Assessment & Compliance performs static vulnerability analysis, license and package compliance. LI Witness provides deep insight and analytics into containerized applications. Control provides dynamic runtime security and analytics for containerized applications. You can find out more about the Layered Insight Suite at [http://layeredinsight.com](http://layeredinsight.com).

    OpenAPI spec version: 0.10
    Contact: help@layeredinsight.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from pprint import pformat
from six import iteritems
import re


class ScanPolicyRule(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """


    """
    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.
    """
    swagger_types = {
        'id': 'str',
        'user_id': 'str',
        'group_id': 'str',
        'uri': 'str',
        'date_created': 'str',
        'date_updated': 'str',
        'name': 'str',
        'type': 'str',
        'vulnerability_type': 'str',
        'package': 'str',
        'package_version': 'str',
        'package_version_operator': 'str',
        'action': 'str'
    }

    attribute_map = {
        'id': 'ID',
        'user_id': 'UserID',
        'group_id': 'GroupID',
        'uri': 'URI',
        'date_created': 'DateCreated',
        'date_updated': 'DateUpdated',
        'name': 'Name',
        'type': 'Type',
        'vulnerability_type': 'VulnerabilityType',
        'package': 'Package',
        'package_version': 'PackageVersion',
        'package_version_operator': 'PackageVersionOperator',
        'action': 'Action'
    }

    def __init__(self, id=None, user_id=None, group_id=None, uri=None, date_created=None, date_updated=None, name=None, type=None, vulnerability_type=None, package=None, package_version=None, package_version_operator=None, action=None):
        """
        ScanPolicyRule - a model defined in Swagger
        """

        self._id = None
        self._user_id = None
        self._group_id = None
        self._uri = None
        self._date_created = None
        self._date_updated = None
        self._name = None
        self._type = None
        self._vulnerability_type = None
        self._package = None
        self._package_version = None
        self._package_version_operator = None
        self._action = None

        if id is not None:
          self.id = id
        if user_id is not None:
          self.user_id = user_id
        if group_id is not None:
          self.group_id = group_id
        if uri is not None:
          self.uri = uri
        if date_created is not None:
          self.date_created = date_created
        if date_updated is not None:
          self.date_updated = date_updated
        if name is not None:
          self.name = name
        if type is not None:
          self.type = type
        if vulnerability_type is not None:
          self.vulnerability_type = vulnerability_type
        if package is not None:
          self.package = package
        if package_version is not None:
          self.package_version = package_version
        if package_version_operator is not None:
          self.package_version_operator = package_version_operator
        if action is not None:
          self.action = action

    @property
    def id(self):
        """
        Gets the id of this ScanPolicyRule.
        ID for this rule

        :return: The id of this ScanPolicyRule.
        :rtype: str
        """
        return self._id

    @id.setter
    def id(self, id):
        """
        Sets the id of this ScanPolicyRule.
        ID for this rule

        :param id: The id of this ScanPolicyRule.
        :type: str
        """

        self._id = id

    @property
    def user_id(self):
        """
        Gets the user_id of this ScanPolicyRule.
        ID of owner of this rule

        :return: The user_id of this ScanPolicyRule.
        :rtype: str
        """
        return self._user_id

    @user_id.setter
    def user_id(self, user_id):
        """
        Sets the user_id of this ScanPolicyRule.
        ID of owner of this rule

        :param user_id: The user_id of this ScanPolicyRule.
        :type: str
        """

        self._user_id = user_id

    @property
    def group_id(self):
        """
        Gets the group_id of this ScanPolicyRule.
        Group ID of owner of this rule

        :return: The group_id of this ScanPolicyRule.
        :rtype: str
        """
        return self._group_id

    @group_id.setter
    def group_id(self, group_id):
        """
        Sets the group_id of this ScanPolicyRule.
        Group ID of owner of this rule

        :param group_id: The group_id of this ScanPolicyRule.
        :type: str
        """

        self._group_id = group_id

    @property
    def uri(self):
        """
        Gets the uri of this ScanPolicyRule.

        :return: The uri of this ScanPolicyRule.
        :rtype: str
        """
        return self._uri

    @uri.setter
    def uri(self, uri):
        """
        Sets the uri of this ScanPolicyRule.

        :param uri: The uri of this ScanPolicyRule.
        :type: str
        """

        self._uri = uri

    @property
    def date_created(self):
        """
        Gets the date_created of this ScanPolicyRule.
        Timestamp representing date scan was run

        :return: The date_created of this ScanPolicyRule.
        :rtype: str
        """
        return self._date_created

    @date_created.setter
    def date_created(self, date_created):
        """
        Sets the date_created of this ScanPolicyRule.
        Timestamp representing date scan was run

        :param date_created: The date_created of this ScanPolicyRule.
        :type: str
        """

        self._date_created = date_created

    @property
    def date_updated(self):
        """
        Gets the date_updated of this ScanPolicyRule.
        Timestamp representing date this record was updated

        :return: The date_updated of this ScanPolicyRule.
        :rtype: str
        """
        return self._date_updated

    @date_updated.setter
    def date_updated(self, date_updated):
        """
        Sets the date_updated of this ScanPolicyRule.
        Timestamp representing date this record was updated

        :param date_updated: The date_updated of this ScanPolicyRule.
        :type: str
        """

        self._date_updated = date_updated

    @property
    def name(self):
        """
        Gets the name of this ScanPolicyRule.
        Name of this rule

        :return: The name of this ScanPolicyRule.
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """
        Sets the name of this ScanPolicyRule.
        Name of this rule

        :param name: The name of this ScanPolicyRule.
        :type: str
        """

        self._name = name

    @property
    def type(self):
        """
        Gets the type of this ScanPolicyRule.
        Specifies if this is a Vulnerability or Package rule

        :return: The type of this ScanPolicyRule.
        :rtype: str
        """
        return self._type

    @type.setter
    def type(self, type):
        """
        Sets the type of this ScanPolicyRule.
        Specifies if this is a Vulnerability or Package rule

        :param type: The type of this ScanPolicyRule.
        :type: str
        """
        allowed_values = ["Vulnerability", "Package"]
        if type not in allowed_values:
            raise ValueError(
                "Invalid value for `type` ({0}), must be one of {1}"
                .format(type, allowed_values)
            )

        self._type = type

    @property
    def vulnerability_type(self):
        """
        Gets the vulnerability_type of this ScanPolicyRule.
        For Vulnerability rules, specifies severity

        :return: The vulnerability_type of this ScanPolicyRule.
        :rtype: str
        """
        return self._vulnerability_type

    @vulnerability_type.setter
    def vulnerability_type(self, vulnerability_type):
        """
        Sets the vulnerability_type of this ScanPolicyRule.
        For Vulnerability rules, specifies severity

        :param vulnerability_type: The vulnerability_type of this ScanPolicyRule.
        :type: str
        """
        allowed_values = ["Critical", "High", "Medium", "Low"]
        if vulnerability_type not in allowed_values:
            raise ValueError(
                "Invalid value for `vulnerability_type` ({0}), must be one of {1}"
                .format(vulnerability_type, allowed_values)
            )

        self._vulnerability_type = vulnerability_type

    @property
    def package(self):
        """
        Gets the package of this ScanPolicyRule.
        For Package rules, specifies package name

        :return: The package of this ScanPolicyRule.
        :rtype: str
        """
        return self._package

    @package.setter
    def package(self, package):
        """
        Sets the package of this ScanPolicyRule.
        For Package rules, specifies package name

        :param package: The package of this ScanPolicyRule.
        :type: str
        """

        self._package = package

    @property
    def package_version(self):
        """
        Gets the package_version of this ScanPolicyRule.
        For Package rules, specifies version number to be compared in this rule

        :return: The package_version of this ScanPolicyRule.
        :rtype: str
        """
        return self._package_version

    @package_version.setter
    def package_version(self, package_version):
        """
        Sets the package_version of this ScanPolicyRule.
        For Package rules, specifies version number to be compared in this rule

        :param package_version: The package_version of this ScanPolicyRule.
        :type: str
        """

        self._package_version = package_version

    @property
    def package_version_operator(self):
        """
        Gets the package_version_operator of this ScanPolicyRule.
        For Package rules, specifies if version of package in image should be less than, equal to, or greater than version in PackageVersion parameter.

        :return: The package_version_operator of this ScanPolicyRule.
        :rtype: str
        """
        return self._package_version_operator

    @package_version_operator.setter
    def package_version_operator(self, package_version_operator):
        """
        Sets the package_version_operator of this ScanPolicyRule.
        For Package rules, specifies if version of package in image should be less than, equal to, or greater than version in PackageVersion parameter.

        :param package_version_operator: The package_version_operator of this ScanPolicyRule.
        :type: str
        """
        allowed_values = ["<", "=", ">"]
        if package_version_operator not in allowed_values:
            raise ValueError(
                "Invalid value for `package_version_operator` ({0}), must be one of {1}"
                .format(package_version_operator, allowed_values)
            )

        self._package_version_operator = package_version_operator

    @property
    def action(self):
        """
        Gets the action of this ScanPolicyRule.
        Action to take if this rule matches

        :return: The action of this ScanPolicyRule.
        :rtype: str
        """
        return self._action

    @action.setter
    def action(self, action):
        """
        Sets the action of this ScanPolicyRule.
        Action to take if this rule matches

        :param action: The action of this ScanPolicyRule.
        :type: str
        """
        allowed_values = ["Allow", "Deny"]
        if action not in allowed_values:
            raise ValueError(
                "Invalid value for `action` ({0}), must be one of {1}"
                .format(action, allowed_values)
            )

        self._action = action

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

        for attr, _ in iteritems(self.swagger_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 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, ScanPolicyRule):
            return False

        return self.__dict__ == other.__dict__

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