# coding: utf-8

"""
    Selling Partner API for Retail Procurement Shipments

    The Selling Partner API for Retail Procurement Shipments provides programmatic access to retail shipping data for vendors.

    The version of the OpenAPI document: v1
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


import pprint
import re  # noqa: F401

import six

from spapi.configuration import Configuration


class ItemQuantity(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    """

    """
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    swagger_types = {
        'amount': 'int',
        'unit_of_measure': 'str',
        'unit_size': 'int',
        'total_weight': 'TotalWeight',
    }

    attribute_map = {
        'amount': 'amount',
        'unit_of_measure': 'unitOfMeasure',
        'unit_size': 'unitSize',
        'total_weight': 'totalWeight',
    }

    def __init__(self, amount=None, unit_of_measure=None, unit_size=None, total_weight=None, _configuration=None):  # noqa: E501
        """ItemQuantity - a model defined in Swagger"""  # noqa: E501
        if _configuration is None:
            _configuration = Configuration()
        self._configuration = _configuration

        self._amount = None
        self._unit_of_measure = None
        self._unit_size = None
        self._total_weight = None
        self.discriminator = None

        self.amount = amount
        self.unit_of_measure = unit_of_measure
        if unit_size is not None:
            self.unit_size = unit_size
        if total_weight is not None:
            self.total_weight = total_weight

    @property
    def amount(self):
        """Gets the amount of this ItemQuantity.  # noqa: E501

        Amount of units shipped for a specific item at a shipment level. If the item is present only in certain cartons or pallets within the shipment, please provide this at the appropriate carton or pallet level.  # noqa: E501

        :return: The amount of this ItemQuantity.  # noqa: E501
        :rtype: int
        """
        return self._amount

    @amount.setter
    def amount(self, amount):
        """Sets the amount of this ItemQuantity.

        Amount of units shipped for a specific item at a shipment level. If the item is present only in certain cartons or pallets within the shipment, please provide this at the appropriate carton or pallet level.  # noqa: E501

        :param amount: The amount of this ItemQuantity.  # noqa: E501
        :type: int
        """
        if self._configuration.client_side_validation and amount is None:
            raise ValueError("Invalid value for `amount`, must not be `None`")  # noqa: E501

        self._amount = amount

    @property
    def unit_of_measure(self):
        """Gets the unit_of_measure of this ItemQuantity.  # noqa: E501

        Unit of measure for the shipped quantity.  # noqa: E501

        :return: The unit_of_measure of this ItemQuantity.  # noqa: E501
        :rtype: str
        """
        return self._unit_of_measure

    @unit_of_measure.setter
    def unit_of_measure(self, unit_of_measure):
        """Sets the unit_of_measure of this ItemQuantity.

        Unit of measure for the shipped quantity.  # noqa: E501

        :param unit_of_measure: The unit_of_measure of this ItemQuantity.  # noqa: E501
        :type: str
        """
        if self._configuration.client_side_validation and unit_of_measure is None:
            raise ValueError("Invalid value for `unit_of_measure`, must not be `None`")  # noqa: E501
        allowed_values = ["Cases", "Eaches"]  # noqa: E501
        if (self._configuration.client_side_validation and
                unit_of_measure not in allowed_values):
            raise ValueError(
                "Invalid value for `unit_of_measure` ({0}), must be one of {1}"  # noqa: E501
                .format(unit_of_measure, allowed_values)
            )

        self._unit_of_measure = unit_of_measure

    @property
    def unit_size(self):
        """Gets the unit_size of this ItemQuantity.  # noqa: E501

        The case size, in the event that we ordered using cases. Otherwise, 1.  # noqa: E501

        :return: The unit_size of this ItemQuantity.  # noqa: E501
        :rtype: int
        """
        return self._unit_size

    @unit_size.setter
    def unit_size(self, unit_size):
        """Sets the unit_size of this ItemQuantity.

        The case size, in the event that we ordered using cases. Otherwise, 1.  # noqa: E501

        :param unit_size: The unit_size of this ItemQuantity.  # noqa: E501
        :type: int
        """

        self._unit_size = unit_size

    @property
    def total_weight(self):
        """Gets the total_weight of this ItemQuantity.  # noqa: E501


        :return: The total_weight of this ItemQuantity.  # noqa: E501
        :rtype: TotalWeight
        """
        return self._total_weight

    @total_weight.setter
    def total_weight(self, total_weight):
        """Sets the total_weight of this ItemQuantity.


        :param total_weight: The total_weight of this ItemQuantity.  # noqa: E501
        :type: TotalWeight
        """

        self._total_weight = total_weight

    def to_dict(self):
        """Returns the model properties as a dict"""
        result = {}

        for attr, _ in six.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
        if issubclass(ItemQuantity, dict):
            for key, value in self.items():
                result[key] = value

        return result

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.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"""
        if not isinstance(other, ItemQuantity):
            return False

        return self.to_dict() == other.to_dict()

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        if not isinstance(other, ItemQuantity):
            return True

        return self.to_dict() != other.to_dict()
