# coding: utf-8

"""
Copyright 2017 Square, Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""


from pprint import pformat
from six import iteritems
import re


class ObtainTokenResponse(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """
    def __init__(self, access_token=None, token_type=None, expires_at=None, merchant_id=None, subscription_id=None, plan_id=None, id_token=None, refresh_token=None):
        """
        ObtainTokenResponse - a model defined in Swagger

        :param dict swaggerTypes: The key is attribute name
                                  and the value is attribute type.
        :param dict attributeMap: The key is attribute name
                                  and the value is json key in definition.
        """
        self.swagger_types = {
            'access_token': 'str',
            'token_type': 'str',
            'expires_at': 'str',
            'merchant_id': 'str',
            'subscription_id': 'str',
            'plan_id': 'str',
            'id_token': 'str',
            'refresh_token': 'str'
        }

        self.attribute_map = {
            'access_token': 'access_token',
            'token_type': 'token_type',
            'expires_at': 'expires_at',
            'merchant_id': 'merchant_id',
            'subscription_id': 'subscription_id',
            'plan_id': 'plan_id',
            'id_token': 'id_token',
            'refresh_token': 'refresh_token'
        }

        self._access_token = access_token
        self._token_type = token_type
        self._expires_at = expires_at
        self._merchant_id = merchant_id
        self._subscription_id = subscription_id
        self._plan_id = plan_id
        self._id_token = id_token
        self._refresh_token = refresh_token

    @property
    def access_token(self):
        """
        Gets the access_token of this ObtainTokenResponse.
        A valid OAuth access token. OAuth access tokens are 64 bytes long. Provide the access token in a header with every request to Connect API endpoints. See the [Build with OAuth](/authz/oauth/build-with-the-api) guide for more information.

        :return: The access_token of this ObtainTokenResponse.
        :rtype: str
        """
        return self._access_token

    @access_token.setter
    def access_token(self, access_token):
        """
        Sets the access_token of this ObtainTokenResponse.
        A valid OAuth access token. OAuth access tokens are 64 bytes long. Provide the access token in a header with every request to Connect API endpoints. See the [Build with OAuth](/authz/oauth/build-with-the-api) guide for more information.

        :param access_token: The access_token of this ObtainTokenResponse.
        :type: str
        """

        self._access_token = access_token

    @property
    def token_type(self):
        """
        Gets the token_type of this ObtainTokenResponse.
        This value is always _bearer_.

        :return: The token_type of this ObtainTokenResponse.
        :rtype: str
        """
        return self._token_type

    @token_type.setter
    def token_type(self, token_type):
        """
        Sets the token_type of this ObtainTokenResponse.
        This value is always _bearer_.

        :param token_type: The token_type of this ObtainTokenResponse.
        :type: str
        """

        self._token_type = token_type

    @property
    def expires_at(self):
        """
        Gets the expires_at of this ObtainTokenResponse.
        The date when access_token expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.

        :return: The expires_at of this ObtainTokenResponse.
        :rtype: str
        """
        return self._expires_at

    @expires_at.setter
    def expires_at(self, expires_at):
        """
        Sets the expires_at of this ObtainTokenResponse.
        The date when access_token expires, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format.

        :param expires_at: The expires_at of this ObtainTokenResponse.
        :type: str
        """

        self._expires_at = expires_at

    @property
    def merchant_id(self):
        """
        Gets the merchant_id of this ObtainTokenResponse.
        The ID of the authorizing merchant's business.

        :return: The merchant_id of this ObtainTokenResponse.
        :rtype: str
        """
        return self._merchant_id

    @merchant_id.setter
    def merchant_id(self, merchant_id):
        """
        Sets the merchant_id of this ObtainTokenResponse.
        The ID of the authorizing merchant's business.

        :param merchant_id: The merchant_id of this ObtainTokenResponse.
        :type: str
        """

        self._merchant_id = merchant_id

    @property
    def subscription_id(self):
        """
        Gets the subscription_id of this ObtainTokenResponse.
        __LEGACY FIELD__. The ID of a subscription plan the merchant signed up for. Only present if the merchant signed up for a subscription during authorization.

        :return: The subscription_id of this ObtainTokenResponse.
        :rtype: str
        """
        return self._subscription_id

    @subscription_id.setter
    def subscription_id(self, subscription_id):
        """
        Sets the subscription_id of this ObtainTokenResponse.
        __LEGACY FIELD__. The ID of a subscription plan the merchant signed up for. Only present if the merchant signed up for a subscription during authorization.

        :param subscription_id: The subscription_id of this ObtainTokenResponse.
        :type: str
        """

        self._subscription_id = subscription_id

    @property
    def plan_id(self):
        """
        Gets the plan_id of this ObtainTokenResponse.
        __LEGACY FIELD__. The ID of the subscription plan the merchant signed up for. Only present if the merchant signed up for a subscription during authorization.

        :return: The plan_id of this ObtainTokenResponse.
        :rtype: str
        """
        return self._plan_id

    @plan_id.setter
    def plan_id(self, plan_id):
        """
        Sets the plan_id of this ObtainTokenResponse.
        __LEGACY FIELD__. The ID of the subscription plan the merchant signed up for. Only present if the merchant signed up for a subscription during authorization.

        :param plan_id: The plan_id of this ObtainTokenResponse.
        :type: str
        """

        self._plan_id = plan_id

    @property
    def id_token(self):
        """
        Gets the id_token of this ObtainTokenResponse.
        Then OpenID token belonging to this this person. Only present if the OPENID scope is included in the authorize request.

        :return: The id_token of this ObtainTokenResponse.
        :rtype: str
        """
        return self._id_token

    @id_token.setter
    def id_token(self, id_token):
        """
        Sets the id_token of this ObtainTokenResponse.
        Then OpenID token belonging to this this person. Only present if the OPENID scope is included in the authorize request.

        :param id_token: The id_token of this ObtainTokenResponse.
        :type: str
        """

        self._id_token = id_token

    @property
    def refresh_token(self):
        """
        Gets the refresh_token of this ObtainTokenResponse.
        A refresh token. For more information, see [OAuth access token management](/authz/oauth/how-it-works#oauth-access-token-management).

        :return: The refresh_token of this ObtainTokenResponse.
        :rtype: str
        """
        return self._refresh_token

    @refresh_token.setter
    def refresh_token(self, refresh_token):
        """
        Sets the refresh_token of this ObtainTokenResponse.
        A refresh token. For more information, see [OAuth access token management](/authz/oauth/how-it-works#oauth-access-token-management).

        :param refresh_token: The refresh_token of this ObtainTokenResponse.
        :type: str
        """

        self._refresh_token = refresh_token

    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
        """
        return self.__dict__ == other.__dict__

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