# 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 OrderReturn(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """
    def __init__(self, uid=None, source_order_id=None, return_line_items=None, return_service_charges=None, return_taxes=None, return_discounts=None, rounding_adjustment=None, return_amounts=None):
        """
        OrderReturn - 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 = {
            'uid': 'str',
            'source_order_id': 'str',
            'return_line_items': 'list[OrderReturnLineItem]',
            'return_service_charges': 'list[OrderReturnServiceCharge]',
            'return_taxes': 'list[OrderReturnTax]',
            'return_discounts': 'list[OrderReturnDiscount]',
            'rounding_adjustment': 'OrderRoundingAdjustment',
            'return_amounts': 'OrderMoneyAmounts'
        }

        self.attribute_map = {
            'uid': 'uid',
            'source_order_id': 'source_order_id',
            'return_line_items': 'return_line_items',
            'return_service_charges': 'return_service_charges',
            'return_taxes': 'return_taxes',
            'return_discounts': 'return_discounts',
            'rounding_adjustment': 'rounding_adjustment',
            'return_amounts': 'return_amounts'
        }

        self._uid = uid
        self._source_order_id = source_order_id
        self._return_line_items = return_line_items
        self._return_service_charges = return_service_charges
        self._return_taxes = return_taxes
        self._return_discounts = return_discounts
        self._rounding_adjustment = rounding_adjustment
        self._return_amounts = return_amounts

    @property
    def uid(self):
        """
        Gets the uid of this OrderReturn.
        Unique ID that identifies the return only within this order.  This field is read-only.

        :return: The uid of this OrderReturn.
        :rtype: str
        """
        return self._uid

    @uid.setter
    def uid(self, uid):
        """
        Sets the uid of this OrderReturn.
        Unique ID that identifies the return only within this order.  This field is read-only.

        :param uid: The uid of this OrderReturn.
        :type: str
        """

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

        self._uid = uid

    @property
    def source_order_id(self):
        """
        Gets the source_order_id of this OrderReturn.
        Order which contains the original sale of these returned line items. This will be unset for unlinked returns.

        :return: The source_order_id of this OrderReturn.
        :rtype: str
        """
        return self._source_order_id

    @source_order_id.setter
    def source_order_id(self, source_order_id):
        """
        Sets the source_order_id of this OrderReturn.
        Order which contains the original sale of these returned line items. This will be unset for unlinked returns.

        :param source_order_id: The source_order_id of this OrderReturn.
        :type: str
        """

        self._source_order_id = source_order_id

    @property
    def return_line_items(self):
        """
        Gets the return_line_items of this OrderReturn.
        Collection of line items which are being returned.

        :return: The return_line_items of this OrderReturn.
        :rtype: list[OrderReturnLineItem]
        """
        return self._return_line_items

    @return_line_items.setter
    def return_line_items(self, return_line_items):
        """
        Sets the return_line_items of this OrderReturn.
        Collection of line items which are being returned.

        :param return_line_items: The return_line_items of this OrderReturn.
        :type: list[OrderReturnLineItem]
        """

        self._return_line_items = return_line_items

    @property
    def return_service_charges(self):
        """
        Gets the return_service_charges of this OrderReturn.
        Collection of service charges which are being returned.  This field is read-only.

        :return: The return_service_charges of this OrderReturn.
        :rtype: list[OrderReturnServiceCharge]
        """
        return self._return_service_charges

    @return_service_charges.setter
    def return_service_charges(self, return_service_charges):
        """
        Sets the return_service_charges of this OrderReturn.
        Collection of service charges which are being returned.  This field is read-only.

        :param return_service_charges: The return_service_charges of this OrderReturn.
        :type: list[OrderReturnServiceCharge]
        """

        self._return_service_charges = return_service_charges

    @property
    def return_taxes(self):
        """
        Gets the return_taxes of this OrderReturn.
        Collection of taxes which are being returned.

        :return: The return_taxes of this OrderReturn.
        :rtype: list[OrderReturnTax]
        """
        return self._return_taxes

    @return_taxes.setter
    def return_taxes(self, return_taxes):
        """
        Sets the return_taxes of this OrderReturn.
        Collection of taxes which are being returned.

        :param return_taxes: The return_taxes of this OrderReturn.
        :type: list[OrderReturnTax]
        """

        self._return_taxes = return_taxes

    @property
    def return_discounts(self):
        """
        Gets the return_discounts of this OrderReturn.
        Collection of discounts which are being returned.

        :return: The return_discounts of this OrderReturn.
        :rtype: list[OrderReturnDiscount]
        """
        return self._return_discounts

    @return_discounts.setter
    def return_discounts(self, return_discounts):
        """
        Sets the return_discounts of this OrderReturn.
        Collection of discounts which are being returned.

        :param return_discounts: The return_discounts of this OrderReturn.
        :type: list[OrderReturnDiscount]
        """

        self._return_discounts = return_discounts

    @property
    def rounding_adjustment(self):
        """
        Gets the rounding_adjustment of this OrderReturn.
        A positive or negative rounding adjustment to the total value being returned. Commonly used to apply Cash Rounding when the minimum unit of account is smaller than the lowest physical denomination of currency.

        :return: The rounding_adjustment of this OrderReturn.
        :rtype: OrderRoundingAdjustment
        """
        return self._rounding_adjustment

    @rounding_adjustment.setter
    def rounding_adjustment(self, rounding_adjustment):
        """
        Sets the rounding_adjustment of this OrderReturn.
        A positive or negative rounding adjustment to the total value being returned. Commonly used to apply Cash Rounding when the minimum unit of account is smaller than the lowest physical denomination of currency.

        :param rounding_adjustment: The rounding_adjustment of this OrderReturn.
        :type: OrderRoundingAdjustment
        """

        self._rounding_adjustment = rounding_adjustment

    @property
    def return_amounts(self):
        """
        Gets the return_amounts of this OrderReturn.
        Aggregate monetary value being returned by this Return entry.

        :return: The return_amounts of this OrderReturn.
        :rtype: OrderMoneyAmounts
        """
        return self._return_amounts

    @return_amounts.setter
    def return_amounts(self, return_amounts):
        """
        Sets the return_amounts of this OrderReturn.
        Aggregate monetary value being returned by this Return entry.

        :param return_amounts: The return_amounts of this OrderReturn.
        :type: OrderMoneyAmounts
        """

        self._return_amounts = return_amounts

    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
