# 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 CreateOrderRequest(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """
    def __init__(self, order=None, idempotency_key=None, reference_id=None, line_items=None, taxes=None, discounts=None):
        """
        CreateOrderRequest - 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 = {
            'order': 'Order',
            'idempotency_key': 'str',
            'reference_id': 'str',
            'line_items': 'list[CreateOrderRequestLineItem]',
            'taxes': 'list[CreateOrderRequestTax]',
            'discounts': 'list[CreateOrderRequestDiscount]'
        }

        self.attribute_map = {
            'order': 'order',
            'idempotency_key': 'idempotency_key',
            'reference_id': 'reference_id',
            'line_items': 'line_items',
            'taxes': 'taxes',
            'discounts': 'discounts'
        }

        self._order = order
        self._idempotency_key = idempotency_key
        self._reference_id = reference_id
        self._line_items = line_items
        self._taxes = taxes
        self._discounts = discounts

    @property
    def order(self):
        """
        Gets the order of this CreateOrderRequest.
        The order to create. If this field is set, then the only other top-level field that can be set is the idempotency_key.

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

    @order.setter
    def order(self, order):
        """
        Sets the order of this CreateOrderRequest.
        The order to create. If this field is set, then the only other top-level field that can be set is the idempotency_key.

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

        self._order = order

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

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

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

        :param idempotency_key: The idempotency_key of this CreateOrderRequest.
        :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`")

        self._idempotency_key = idempotency_key

    @property
    def reference_id(self):
        """
        Gets the reference_id of this CreateOrderRequest.
        __Deprecated__: Please set the reference_id on the nested [order](#type-order) field instead.  An optional ID you can associate with the order for your own purposes (such as to associate the order with an entity ID in your own database).  This value cannot exceed 40 characters.

        :return: The reference_id of this CreateOrderRequest.
        :rtype: str
        """
        return self._reference_id

    @reference_id.setter
    def reference_id(self, reference_id):
        """
        Sets the reference_id of this CreateOrderRequest.
        __Deprecated__: Please set the reference_id on the nested [order](#type-order) field instead.  An optional ID you can associate with the order for your own purposes (such as to associate the order with an entity ID in your own database).  This value cannot exceed 40 characters.

        :param reference_id: The reference_id of this CreateOrderRequest.
        :type: str
        """

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

        self._reference_id = reference_id

    @property
    def line_items(self):
        """
        Gets the line_items of this CreateOrderRequest.
        __Deprecated__: Please set the line_items on the nested [order](#type-order) field instead.  The line items to associate with this order.  Each line item represents a different product to include in a purchase.

        :return: The line_items of this CreateOrderRequest.
        :rtype: list[CreateOrderRequestLineItem]
        """
        return self._line_items

    @line_items.setter
    def line_items(self, line_items):
        """
        Sets the line_items of this CreateOrderRequest.
        __Deprecated__: Please set the line_items on the nested [order](#type-order) field instead.  The line items to associate with this order.  Each line item represents a different product to include in a purchase.

        :param line_items: The line_items of this CreateOrderRequest.
        :type: list[CreateOrderRequestLineItem]
        """

        self._line_items = line_items

    @property
    def taxes(self):
        """
        Gets the taxes of this CreateOrderRequest.
        __Deprecated__: Please set the taxes on the nested [order](#type-order) field instead.  The taxes to include on the order.

        :return: The taxes of this CreateOrderRequest.
        :rtype: list[CreateOrderRequestTax]
        """
        return self._taxes

    @taxes.setter
    def taxes(self, taxes):
        """
        Sets the taxes of this CreateOrderRequest.
        __Deprecated__: Please set the taxes on the nested [order](#type-order) field instead.  The taxes to include on the order.

        :param taxes: The taxes of this CreateOrderRequest.
        :type: list[CreateOrderRequestTax]
        """

        self._taxes = taxes

    @property
    def discounts(self):
        """
        Gets the discounts of this CreateOrderRequest.
        __Deprecated__: Please set the discounts on the nested [order](#type-order) field instead.  The discounts to include on the order.

        :return: The discounts of this CreateOrderRequest.
        :rtype: list[CreateOrderRequestDiscount]
        """
        return self._discounts

    @discounts.setter
    def discounts(self, discounts):
        """
        Sets the discounts of this CreateOrderRequest.
        __Deprecated__: Please set the discounts on the nested [order](#type-order) field instead.  The discounts to include on the order.

        :param discounts: The discounts of this CreateOrderRequest.
        :type: list[CreateOrderRequestDiscount]
        """

        self._discounts = discounts

    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
