# 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 CreateRefundRequest(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """
    def __init__(self, idempotency_key=None, tender_id=None, reason=None, amount_money=None):
        """
        CreateRefundRequest - 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 = {
            'idempotency_key': 'str',
            'tender_id': 'str',
            'reason': 'str',
            'amount_money': 'Money'
        }

        self.attribute_map = {
            'idempotency_key': 'idempotency_key',
            'tender_id': 'tender_id',
            'reason': 'reason',
            'amount_money': 'amount_money'
        }

        self._idempotency_key = idempotency_key
        self._tender_id = tender_id
        self._reason = reason
        self._amount_money = amount_money

    @property
    def idempotency_key(self):
        """
        Gets the idempotency_key of this CreateRefundRequest.
        A value you specify that uniquely identifies this refund among refunds you've created for the tender.  If you're unsure whether a particular refund succeeded, you can reattempt it with the same idempotency key without worrying about duplicating the refund.  See [Idempotency](/basics/api101/idempotency) for more information.

        :return: The idempotency_key of this CreateRefundRequest.
        :rtype: str
        """
        return self._idempotency_key

    @idempotency_key.setter
    def idempotency_key(self, idempotency_key):
        """
        Sets the idempotency_key of this CreateRefundRequest.
        A value you specify that uniquely identifies this refund among refunds you've created for the tender.  If you're unsure whether a particular refund succeeded, you can reattempt it with the same idempotency key without worrying about duplicating the refund.  See [Idempotency](/basics/api101/idempotency) for more information.

        :param idempotency_key: The idempotency_key of this CreateRefundRequest.
        :type: str
        """

        if idempotency_key is None:
            raise ValueError("Invalid value for `idempotency_key`, must not be `None`")
        if len(idempotency_key) > 192:
            raise ValueError("Invalid value for `idempotency_key`, length must be less than `192`")
        if len(idempotency_key) < 1:
            raise ValueError("Invalid value for `idempotency_key`, length must be greater than or equal to `1`")

        self._idempotency_key = idempotency_key

    @property
    def tender_id(self):
        """
        Gets the tender_id of this CreateRefundRequest.
        The ID of the tender to refund.  A [`Transaction`](#type-transaction) has one or more `tenders` (i.e., methods of payment) associated with it, and you refund each tender separately with the Connect API.

        :return: The tender_id of this CreateRefundRequest.
        :rtype: str
        """
        return self._tender_id

    @tender_id.setter
    def tender_id(self, tender_id):
        """
        Sets the tender_id of this CreateRefundRequest.
        The ID of the tender to refund.  A [`Transaction`](#type-transaction) has one or more `tenders` (i.e., methods of payment) associated with it, and you refund each tender separately with the Connect API.

        :param tender_id: The tender_id of this CreateRefundRequest.
        :type: str
        """

        if tender_id is None:
            raise ValueError("Invalid value for `tender_id`, must not be `None`")
        if len(tender_id) > 192:
            raise ValueError("Invalid value for `tender_id`, length must be less than `192`")
        if len(tender_id) < 1:
            raise ValueError("Invalid value for `tender_id`, length must be greater than or equal to `1`")

        self._tender_id = tender_id

    @property
    def reason(self):
        """
        Gets the reason of this CreateRefundRequest.
        A description of the reason for the refund.  Default value: `Refund via API`

        :return: The reason of this CreateRefundRequest.
        :rtype: str
        """
        return self._reason

    @reason.setter
    def reason(self, reason):
        """
        Sets the reason of this CreateRefundRequest.
        A description of the reason for the refund.  Default value: `Refund via API`

        :param reason: The reason of this CreateRefundRequest.
        :type: str
        """

        if reason is None:
            raise ValueError("Invalid value for `reason`, must not be `None`")
        if len(reason) > 192:
            raise ValueError("Invalid value for `reason`, length must be less than `192`")

        self._reason = reason

    @property
    def amount_money(self):
        """
        Gets the amount_money of this CreateRefundRequest.
        The amount of money to refund.  Note that you specify the amount in the __smallest denomination of the applicable currency__. For example, US dollar amounts are specified in cents. See [Working with monetary amounts](#workingwithmonetaryamounts) for details.  This amount cannot exceed the amount that was originally charged to the tender that corresponds to `tender_id`.

        :return: The amount_money of this CreateRefundRequest.
        :rtype: Money
        """
        return self._amount_money

    @amount_money.setter
    def amount_money(self, amount_money):
        """
        Sets the amount_money of this CreateRefundRequest.
        The amount of money to refund.  Note that you specify the amount in the __smallest denomination of the applicable currency__. For example, US dollar amounts are specified in cents. See [Working with monetary amounts](#workingwithmonetaryamounts) for details.  This amount cannot exceed the amount that was originally charged to the tender that corresponds to `tender_id`.

        :param amount_money: The amount_money of this CreateRefundRequest.
        :type: Money
        """

        self._amount_money = amount_money

    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
