# 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 InventoryAdjustment(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """
    def __init__(self, id=None, reference_id=None, from_state=None, to_state=None, location_id=None, catalog_object_id=None, catalog_object_type=None, quantity=None, total_price_money=None, occurred_at=None, created_at=None, source=None, employee_id=None, transaction_id=None, refund_id=None, purchase_order_id=None, goods_receipt_id=None):
        """
        InventoryAdjustment - 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',
            'reference_id': 'str',
            'from_state': 'str',
            'to_state': 'str',
            'location_id': 'str',
            'catalog_object_id': 'str',
            'catalog_object_type': 'str',
            'quantity': 'str',
            'total_price_money': 'Money',
            'occurred_at': 'str',
            'created_at': 'str',
            'source': 'SourceApplication',
            'employee_id': 'str',
            'transaction_id': 'str',
            'refund_id': 'str',
            'purchase_order_id': 'str',
            'goods_receipt_id': 'str'
        }

        self.attribute_map = {
            'id': 'id',
            'reference_id': 'reference_id',
            'from_state': 'from_state',
            'to_state': 'to_state',
            'location_id': 'location_id',
            'catalog_object_id': 'catalog_object_id',
            'catalog_object_type': 'catalog_object_type',
            'quantity': 'quantity',
            'total_price_money': 'total_price_money',
            'occurred_at': 'occurred_at',
            'created_at': 'created_at',
            'source': 'source',
            'employee_id': 'employee_id',
            'transaction_id': 'transaction_id',
            'refund_id': 'refund_id',
            'purchase_order_id': 'purchase_order_id',
            'goods_receipt_id': 'goods_receipt_id'
        }

        self._id = id
        self._reference_id = reference_id
        self._from_state = from_state
        self._to_state = to_state
        self._location_id = location_id
        self._catalog_object_id = catalog_object_id
        self._catalog_object_type = catalog_object_type
        self._quantity = quantity
        self._total_price_money = total_price_money
        self._occurred_at = occurred_at
        self._created_at = created_at
        self._source = source
        self._employee_id = employee_id
        self._transaction_id = transaction_id
        self._refund_id = refund_id
        self._purchase_order_id = purchase_order_id
        self._goods_receipt_id = goods_receipt_id

    @property
    def id(self):
        """
        Gets the id of this InventoryAdjustment.
        A unique ID generated by Square for the [InventoryAdjustment](#type-inventoryadjustment).

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

    @id.setter
    def id(self, id):
        """
        Sets the id of this InventoryAdjustment.
        A unique ID generated by Square for the [InventoryAdjustment](#type-inventoryadjustment).

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

        self._id = id

    @property
    def reference_id(self):
        """
        Gets the reference_id of this InventoryAdjustment.
        An optional ID provided by the application to tie the [InventoryAdjustment](#type-inventoryadjustment) to an external system.

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

    @reference_id.setter
    def reference_id(self, reference_id):
        """
        Sets the reference_id of this InventoryAdjustment.
        An optional ID provided by the application to tie the [InventoryAdjustment](#type-inventoryadjustment) to an external system.

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

        self._reference_id = reference_id

    @property
    def from_state(self):
        """
        Gets the from_state of this InventoryAdjustment.
        The [InventoryState](#type-inventorystate) of the related quantity of items before the adjustment.

        :return: The from_state of this InventoryAdjustment.
        :rtype: str
        """
        return self._from_state

    @from_state.setter
    def from_state(self, from_state):
        """
        Sets the from_state of this InventoryAdjustment.
        The [InventoryState](#type-inventorystate) of the related quantity of items before the adjustment.

        :param from_state: The from_state of this InventoryAdjustment.
        :type: str
        """

        self._from_state = from_state

    @property
    def to_state(self):
        """
        Gets the to_state of this InventoryAdjustment.
        The [InventoryState](#type-inventorystate) of the related quantity of items after the adjustment.

        :return: The to_state of this InventoryAdjustment.
        :rtype: str
        """
        return self._to_state

    @to_state.setter
    def to_state(self, to_state):
        """
        Sets the to_state of this InventoryAdjustment.
        The [InventoryState](#type-inventorystate) of the related quantity of items after the adjustment.

        :param to_state: The to_state of this InventoryAdjustment.
        :type: str
        """

        self._to_state = to_state

    @property
    def location_id(self):
        """
        Gets the location_id of this InventoryAdjustment.
        The Square ID of the [Location](#type-location) where the related quantity of items are being tracked.

        :return: The location_id of this InventoryAdjustment.
        :rtype: str
        """
        return self._location_id

    @location_id.setter
    def location_id(self, location_id):
        """
        Sets the location_id of this InventoryAdjustment.
        The Square ID of the [Location](#type-location) where the related quantity of items are being tracked.

        :param location_id: The location_id of this InventoryAdjustment.
        :type: str
        """

        self._location_id = location_id

    @property
    def catalog_object_id(self):
        """
        Gets the catalog_object_id of this InventoryAdjustment.
        The Square generated ID of the [CatalogObject](#type-catalogobject) being tracked.

        :return: The catalog_object_id of this InventoryAdjustment.
        :rtype: str
        """
        return self._catalog_object_id

    @catalog_object_id.setter
    def catalog_object_id(self, catalog_object_id):
        """
        Sets the catalog_object_id of this InventoryAdjustment.
        The Square generated ID of the [CatalogObject](#type-catalogobject) being tracked.

        :param catalog_object_id: The catalog_object_id of this InventoryAdjustment.
        :type: str
        """

        self._catalog_object_id = catalog_object_id

    @property
    def catalog_object_type(self):
        """
        Gets the catalog_object_type of this InventoryAdjustment.
        The [CatalogObjectType](#type-catalogobjecttype) of the [CatalogObject](#type-catalogobject) being tracked. Tracking is only supported for the `ITEM_VARIATION` type.

        :return: The catalog_object_type of this InventoryAdjustment.
        :rtype: str
        """
        return self._catalog_object_type

    @catalog_object_type.setter
    def catalog_object_type(self, catalog_object_type):
        """
        Sets the catalog_object_type of this InventoryAdjustment.
        The [CatalogObjectType](#type-catalogobjecttype) of the [CatalogObject](#type-catalogobject) being tracked. Tracking is only supported for the `ITEM_VARIATION` type.

        :param catalog_object_type: The catalog_object_type of this InventoryAdjustment.
        :type: str
        """

        self._catalog_object_type = catalog_object_type

    @property
    def quantity(self):
        """
        Gets the quantity of this InventoryAdjustment.
        The number of items affected by the adjustment as a decimal string. Fractional quantities are not supported.

        :return: The quantity of this InventoryAdjustment.
        :rtype: str
        """
        return self._quantity

    @quantity.setter
    def quantity(self, quantity):
        """
        Sets the quantity of this InventoryAdjustment.
        The number of items affected by the adjustment as a decimal string. Fractional quantities are not supported.

        :param quantity: The quantity of this InventoryAdjustment.
        :type: str
        """

        self._quantity = quantity

    @property
    def total_price_money(self):
        """
        Gets the total_price_money of this InventoryAdjustment.
        The read-only total price paid for goods associated with the adjustment. Present if and only if `to_state` is `SOLD`. Always non-negative.

        :return: The total_price_money of this InventoryAdjustment.
        :rtype: Money
        """
        return self._total_price_money

    @total_price_money.setter
    def total_price_money(self, total_price_money):
        """
        Sets the total_price_money of this InventoryAdjustment.
        The read-only total price paid for goods associated with the adjustment. Present if and only if `to_state` is `SOLD`. Always non-negative.

        :param total_price_money: The total_price_money of this InventoryAdjustment.
        :type: Money
        """

        self._total_price_money = total_price_money

    @property
    def occurred_at(self):
        """
        Gets the occurred_at of this InventoryAdjustment.
        A client-generated timestamp in RFC 3339 format that indicates when the adjustment took place. For write actions, the `occurred_at` timestamp cannot be older than 24 hours or in the future relative to the time of the request.

        :return: The occurred_at of this InventoryAdjustment.
        :rtype: str
        """
        return self._occurred_at

    @occurred_at.setter
    def occurred_at(self, occurred_at):
        """
        Sets the occurred_at of this InventoryAdjustment.
        A client-generated timestamp in RFC 3339 format that indicates when the adjustment took place. For write actions, the `occurred_at` timestamp cannot be older than 24 hours or in the future relative to the time of the request.

        :param occurred_at: The occurred_at of this InventoryAdjustment.
        :type: str
        """

        self._occurred_at = occurred_at

    @property
    def created_at(self):
        """
        Gets the created_at of this InventoryAdjustment.
        A read-only timestamp in RFC 3339 format that indicates when Square received the adjustment.

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

    @created_at.setter
    def created_at(self, created_at):
        """
        Sets the created_at of this InventoryAdjustment.
        A read-only timestamp in RFC 3339 format that indicates when Square received the adjustment.

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

        self._created_at = created_at

    @property
    def source(self):
        """
        Gets the source of this InventoryAdjustment.
        Read-only information about the application that caused the inventory adjustment.

        :return: The source of this InventoryAdjustment.
        :rtype: SourceApplication
        """
        return self._source

    @source.setter
    def source(self, source):
        """
        Sets the source of this InventoryAdjustment.
        Read-only information about the application that caused the inventory adjustment.

        :param source: The source of this InventoryAdjustment.
        :type: SourceApplication
        """

        self._source = source

    @property
    def employee_id(self):
        """
        Gets the employee_id of this InventoryAdjustment.
        The Square ID of the [Employee](#type-employee) responsible for the inventory adjustment.

        :return: The employee_id of this InventoryAdjustment.
        :rtype: str
        """
        return self._employee_id

    @employee_id.setter
    def employee_id(self, employee_id):
        """
        Sets the employee_id of this InventoryAdjustment.
        The Square ID of the [Employee](#type-employee) responsible for the inventory adjustment.

        :param employee_id: The employee_id of this InventoryAdjustment.
        :type: str
        """

        self._employee_id = employee_id

    @property
    def transaction_id(self):
        """
        Gets the transaction_id of this InventoryAdjustment.
        The read-only Square ID of the [Transaction][#type-transaction] that caused the adjustment. Only relevant for payment-related state transitions.

        :return: The transaction_id of this InventoryAdjustment.
        :rtype: str
        """
        return self._transaction_id

    @transaction_id.setter
    def transaction_id(self, transaction_id):
        """
        Sets the transaction_id of this InventoryAdjustment.
        The read-only Square ID of the [Transaction][#type-transaction] that caused the adjustment. Only relevant for payment-related state transitions.

        :param transaction_id: The transaction_id of this InventoryAdjustment.
        :type: str
        """

        self._transaction_id = transaction_id

    @property
    def refund_id(self):
        """
        Gets the refund_id of this InventoryAdjustment.
        The read-only Square ID of the [Refund][#type-refund] that caused the adjustment. Only relevant for refund-related state transitions.

        :return: The refund_id of this InventoryAdjustment.
        :rtype: str
        """
        return self._refund_id

    @refund_id.setter
    def refund_id(self, refund_id):
        """
        Sets the refund_id of this InventoryAdjustment.
        The read-only Square ID of the [Refund][#type-refund] that caused the adjustment. Only relevant for refund-related state transitions.

        :param refund_id: The refund_id of this InventoryAdjustment.
        :type: str
        """

        self._refund_id = refund_id

    @property
    def purchase_order_id(self):
        """
        Gets the purchase_order_id of this InventoryAdjustment.
        The read-only Square ID of the purchase order that caused the adjustment. Only relevant for state transitions from the Square for Retail app.

        :return: The purchase_order_id of this InventoryAdjustment.
        :rtype: str
        """
        return self._purchase_order_id

    @purchase_order_id.setter
    def purchase_order_id(self, purchase_order_id):
        """
        Sets the purchase_order_id of this InventoryAdjustment.
        The read-only Square ID of the purchase order that caused the adjustment. Only relevant for state transitions from the Square for Retail app.

        :param purchase_order_id: The purchase_order_id of this InventoryAdjustment.
        :type: str
        """

        self._purchase_order_id = purchase_order_id

    @property
    def goods_receipt_id(self):
        """
        Gets the goods_receipt_id of this InventoryAdjustment.
        The read-only Square ID of the Square goods receipt that caused the adjustment. Only relevant for state transitions from the Square for Retail app.

        :return: The goods_receipt_id of this InventoryAdjustment.
        :rtype: str
        """
        return self._goods_receipt_id

    @goods_receipt_id.setter
    def goods_receipt_id(self, goods_receipt_id):
        """
        Sets the goods_receipt_id of this InventoryAdjustment.
        The read-only Square ID of the Square goods receipt that caused the adjustment. Only relevant for state transitions from the Square for Retail app.

        :param goods_receipt_id: The goods_receipt_id of this InventoryAdjustment.
        :type: str
        """

        self._goods_receipt_id = goods_receipt_id

    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
