# 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 Checkout(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """
    def __init__(self, id=None, checkout_page_url=None, ask_for_shipping_address=None, merchant_support_email=None, pre_populate_buyer_email=None, pre_populate_shipping_address=None, redirect_url=None, order=None, created_at=None, additional_recipients=None):
        """
        Checkout - 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 = {
            'id': 'str',
            'checkout_page_url': 'str',
            'ask_for_shipping_address': 'bool',
            'merchant_support_email': 'str',
            'pre_populate_buyer_email': 'str',
            'pre_populate_shipping_address': 'Address',
            'redirect_url': 'str',
            'order': 'Order',
            'created_at': 'str',
            'additional_recipients': 'list[AdditionalRecipient]'
        }

        self.attribute_map = {
            'id': 'id',
            'checkout_page_url': 'checkout_page_url',
            'ask_for_shipping_address': 'ask_for_shipping_address',
            'merchant_support_email': 'merchant_support_email',
            'pre_populate_buyer_email': 'pre_populate_buyer_email',
            'pre_populate_shipping_address': 'pre_populate_shipping_address',
            'redirect_url': 'redirect_url',
            'order': 'order',
            'created_at': 'created_at',
            'additional_recipients': 'additional_recipients'
        }

        self._id = id
        self._checkout_page_url = checkout_page_url
        self._ask_for_shipping_address = ask_for_shipping_address
        self._merchant_support_email = merchant_support_email
        self._pre_populate_buyer_email = pre_populate_buyer_email
        self._pre_populate_shipping_address = pre_populate_shipping_address
        self._redirect_url = redirect_url
        self._order = order
        self._created_at = created_at
        self._additional_recipients = additional_recipients

    @property
    def id(self):
        """
        Gets the id of this Checkout.
        ID generated by Square Checkout when a new checkout is requested.

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

    @id.setter
    def id(self, id):
        """
        Sets the id of this Checkout.
        ID generated by Square Checkout when a new checkout is requested.

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

        self._id = id

    @property
    def checkout_page_url(self):
        """
        Gets the checkout_page_url of this Checkout.
        The URL that the buyer's browser should be redirected to after the checkout is completed.

        :return: The checkout_page_url of this Checkout.
        :rtype: str
        """
        return self._checkout_page_url

    @checkout_page_url.setter
    def checkout_page_url(self, checkout_page_url):
        """
        Sets the checkout_page_url of this Checkout.
        The URL that the buyer's browser should be redirected to after the checkout is completed.

        :param checkout_page_url: The checkout_page_url of this Checkout.
        :type: str
        """

        self._checkout_page_url = checkout_page_url

    @property
    def ask_for_shipping_address(self):
        """
        Gets the ask_for_shipping_address of this Checkout.
        If `true`, Square Checkout will collect shipping information on your behalf and store that information with the transaction information in your Square Dashboard.  Default: `false`.

        :return: The ask_for_shipping_address of this Checkout.
        :rtype: bool
        """
        return self._ask_for_shipping_address

    @ask_for_shipping_address.setter
    def ask_for_shipping_address(self, ask_for_shipping_address):
        """
        Sets the ask_for_shipping_address of this Checkout.
        If `true`, Square Checkout will collect shipping information on your behalf and store that information with the transaction information in your Square Dashboard.  Default: `false`.

        :param ask_for_shipping_address: The ask_for_shipping_address of this Checkout.
        :type: bool
        """

        self._ask_for_shipping_address = ask_for_shipping_address

    @property
    def merchant_support_email(self):
        """
        Gets the merchant_support_email of this Checkout.
        The email address to display on the Square Checkout confirmation page and confirmation email that the buyer can use to contact the merchant.  If this value is not set, the confirmation page and email will display the primary email address associated with the merchant's Square account.  Default: none; only exists if explicitly set.

        :return: The merchant_support_email of this Checkout.
        :rtype: str
        """
        return self._merchant_support_email

    @merchant_support_email.setter
    def merchant_support_email(self, merchant_support_email):
        """
        Sets the merchant_support_email of this Checkout.
        The email address to display on the Square Checkout confirmation page and confirmation email that the buyer can use to contact the merchant.  If this value is not set, the confirmation page and email will display the primary email address associated with the merchant's Square account.  Default: none; only exists if explicitly set.

        :param merchant_support_email: The merchant_support_email of this Checkout.
        :type: str
        """

        self._merchant_support_email = merchant_support_email

    @property
    def pre_populate_buyer_email(self):
        """
        Gets the pre_populate_buyer_email of this Checkout.
        If provided, the buyer's email is pre-populated on the checkout page as an editable text field.  Default: none; only exists if explicitly set.

        :return: The pre_populate_buyer_email of this Checkout.
        :rtype: str
        """
        return self._pre_populate_buyer_email

    @pre_populate_buyer_email.setter
    def pre_populate_buyer_email(self, pre_populate_buyer_email):
        """
        Sets the pre_populate_buyer_email of this Checkout.
        If provided, the buyer's email is pre-populated on the checkout page as an editable text field.  Default: none; only exists if explicitly set.

        :param pre_populate_buyer_email: The pre_populate_buyer_email of this Checkout.
        :type: str
        """

        self._pre_populate_buyer_email = pre_populate_buyer_email

    @property
    def pre_populate_shipping_address(self):
        """
        Gets the pre_populate_shipping_address of this Checkout.
        If provided, the buyer's shipping info is pre-populated on the checkout page as editable text fields.  Default: none; only exists if explicitly set.

        :return: The pre_populate_shipping_address of this Checkout.
        :rtype: Address
        """
        return self._pre_populate_shipping_address

    @pre_populate_shipping_address.setter
    def pre_populate_shipping_address(self, pre_populate_shipping_address):
        """
        Sets the pre_populate_shipping_address of this Checkout.
        If provided, the buyer's shipping info is pre-populated on the checkout page as editable text fields.  Default: none; only exists if explicitly set.

        :param pre_populate_shipping_address: The pre_populate_shipping_address of this Checkout.
        :type: Address
        """

        self._pre_populate_shipping_address = pre_populate_shipping_address

    @property
    def redirect_url(self):
        """
        Gets the redirect_url of this Checkout.
        The URL to redirect to after checkout is completed with `checkoutId`, Square's `orderId`, `transactionId`, and `referenceId` appended as URL parameters. For example, if the provided redirect_url is `http://www.example.com/order-complete`, a successful transaction redirects the customer to:  `http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx`  If you do not provide a redirect URL, Square Checkout will display an order confirmation page on your behalf; however Square strongly recommends that you provide a redirect URL so you can verify the transaction results and finalize the order through your existing/normal confirmation workflow.

        :return: The redirect_url of this Checkout.
        :rtype: str
        """
        return self._redirect_url

    @redirect_url.setter
    def redirect_url(self, redirect_url):
        """
        Sets the redirect_url of this Checkout.
        The URL to redirect to after checkout is completed with `checkoutId`, Square's `orderId`, `transactionId`, and `referenceId` appended as URL parameters. For example, if the provided redirect_url is `http://www.example.com/order-complete`, a successful transaction redirects the customer to:  `http://www.example.com/order-complete?checkoutId=xxxxxx&orderId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx`  If you do not provide a redirect URL, Square Checkout will display an order confirmation page on your behalf; however Square strongly recommends that you provide a redirect URL so you can verify the transaction results and finalize the order through your existing/normal confirmation workflow.

        :param redirect_url: The redirect_url of this Checkout.
        :type: str
        """

        self._redirect_url = redirect_url

    @property
    def order(self):
        """
        Gets the order of this Checkout.
        Order to be checked out.

        :return: The order of this Checkout.
        :rtype: Order
        """
        return self._order

    @order.setter
    def order(self, order):
        """
        Sets the order of this Checkout.
        Order to be checked out.

        :param order: The order of this Checkout.
        :type: Order
        """

        self._order = order

    @property
    def created_at(self):
        """
        Gets the created_at of this Checkout.
        The time when the checkout was created, in RFC 3339 format.

        :return: The created_at of this Checkout.
        :rtype: str
        """
        return self._created_at

    @created_at.setter
    def created_at(self, created_at):
        """
        Sets the created_at of this Checkout.
        The time when the checkout was created, in RFC 3339 format.

        :param created_at: The created_at of this Checkout.
        :type: str
        """

        self._created_at = created_at

    @property
    def additional_recipients(self):
        """
        Gets the additional_recipients of this Checkout.
        Additional recipients (other than the merchant) receiving a portion of this checkout. For example, fees assessed on the purchase by a third party integration.

        :return: The additional_recipients of this Checkout.
        :rtype: list[AdditionalRecipient]
        """
        return self._additional_recipients

    @additional_recipients.setter
    def additional_recipients(self, additional_recipients):
        """
        Sets the additional_recipients of this Checkout.
        Additional recipients (other than the merchant) receiving a portion of this checkout. For example, fees assessed on the purchase by a third party integration.

        :param additional_recipients: The additional_recipients of this Checkout.
        :type: list[AdditionalRecipient]
        """

        self._additional_recipients = additional_recipients

    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
