# coding: utf-8

"""
    Onfido API

    The Onfido API is used to submit check requests.  # noqa: E501

    OpenAPI spec version: 2.0.0
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six


class Webhook(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': 'str',
        'token': 'str',
        'href': 'str',
        'url': 'str',
        'enabled': 'bool',
        'environments': 'list[str]',
        'events': 'list[str]'
    }

    attribute_map = {
        'id': 'id',
        'token': 'token',
        'href': 'href',
        'url': 'url',
        'enabled': 'enabled',
        'environments': 'environments',
        'events': 'events'
    }

    def __init__(self, id=None, token=None, href=None, url=None, enabled=None, environments=None, events=None):  # noqa: E501
        """Webhook - a model defined in OpenAPI"""  # noqa: E501

        self._id = None
        self._token = None
        self._href = None
        self._url = None
        self._enabled = None
        self._environments = None
        self._events = None
        self.discriminator = None

        if id is not None:
            self.id = id
        if token is not None:
            self.token = token
        if href is not None:
            self.href = href
        self.url = url
        if enabled is not None:
            self.enabled = enabled
        if environments is not None:
            self.environments = environments
        if events is not None:
            self.events = events

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

        The unique identifier of the webhook. Read-only.  # noqa: E501

        :return: The id of this Webhook.  # noqa: E501
        :rtype: str
        """
        return self._id

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

        The unique identifier of the webhook. Read-only.  # noqa: E501

        :param id: The id of this Webhook.  # noqa: E501
        :type: str
        """

        self._id = id

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

        Webhook secret token used to sign the webhook's payload. Read-only.  # noqa: E501

        :return: The token of this Webhook.  # noqa: E501
        :rtype: str
        """
        return self._token

    @token.setter
    def token(self, token):
        """Sets the token of this Webhook.

        Webhook secret token used to sign the webhook's payload. Read-only.  # noqa: E501

        :param token: The token of this Webhook.  # noqa: E501
        :type: str
        """

        self._token = token

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

        The API endpoint to retrieve the webhook. Read-only.  # noqa: E501

        :return: The href of this Webhook.  # noqa: E501
        :rtype: str
        """
        return self._href

    @href.setter
    def href(self, href):
        """Sets the href of this Webhook.

        The API endpoint to retrieve the webhook. Read-only.  # noqa: E501

        :param href: The href of this Webhook.  # noqa: E501
        :type: str
        """

        self._href = href

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

        The url that will listen to notifications (must be https).  # noqa: E501

        :return: The url of this Webhook.  # noqa: E501
        :rtype: str
        """
        return self._url

    @url.setter
    def url(self, url):
        """Sets the url of this Webhook.

        The url that will listen to notifications (must be https).  # noqa: E501

        :param url: The url of this Webhook.  # noqa: E501
        :type: str
        """
        if url is None:
            raise ValueError("Invalid value for `url`, must not be `None`")  # noqa: E501

        self._url = url

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

        Determine if the webhook is active.  # noqa: E501

        :return: The enabled of this Webhook.  # noqa: E501
        :rtype: bool
        """
        return self._enabled

    @enabled.setter
    def enabled(self, enabled):
        """Sets the enabled of this Webhook.

        Determine if the webhook is active.  # noqa: E501

        :param enabled: The enabled of this Webhook.  # noqa: E501
        :type: bool
        """

        self._enabled = enabled

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

        The environments from which the webhook will receive events. Allowed values are “sandbox” and “live”. If the environments parameter is omitted the webhook will receive events from both environments.   # noqa: E501

        :return: The environments of this Webhook.  # noqa: E501
        :rtype: list[str]
        """
        return self._environments

    @environments.setter
    def environments(self, environments):
        """Sets the environments of this Webhook.

        The environments from which the webhook will receive events. Allowed values are “sandbox” and “live”. If the environments parameter is omitted the webhook will receive events from both environments.   # noqa: E501

        :param environments: The environments of this Webhook.  # noqa: E501
        :type: list[str]
        """

        self._environments = environments

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

        The events that will be published to the webhook. The supported events are: `report.completed`, `report.withdrawn`, `check.completed`, `check.started`, `check.form_opened`, `check.form_completed`. If the events parameter is omitted all the events will be subscribed.   # noqa: E501

        :return: The events of this Webhook.  # noqa: E501
        :rtype: list[str]
        """
        return self._events

    @events.setter
    def events(self, events):
        """Sets the events of this Webhook.

        The events that will be published to the webhook. The supported events are: `report.completed`, `report.withdrawn`, `check.completed`, `check.started`, `check.form_opened`, `check.form_completed`. If the events parameter is omitted all the events will be subscribed.   # noqa: E501

        :param events: The events of this Webhook.  # noqa: E501
        :type: list[str]
        """

        self._events = events

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

        return self.__dict__ == other.__dict__

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