# coding: utf-8

"""
    The Selling Partner API for Amazon External Fulfillment Shipments Processing

    You can use the External Fulfillment Shipments API to retrieve, manage, and track shipments processed through Amazon's external fulfillment network. Use this API to get shipment details, monitor status changes, and access fulfillment requirements.

    The version of the OpenAPI document: 2024-09-11
    Contact: marketplaceapitest@amazon.com
    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 Cancellation(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 = {
        'cancelled_quantity': 'int',
        'cancelled_timestamp': 'str',
        'cancellation_type': 'str',
        'cancellation_reason': 'str',
    }

    attribute_map = {
        'cancelled_quantity': 'cancelledQuantity',
        'cancelled_timestamp': 'cancelledTimestamp',
        'cancellation_type': 'cancellationType',
        'cancellation_reason': 'cancellationReason',
    }

    def __init__(self, cancelled_quantity=None, cancelled_timestamp=None, cancellation_type=None, cancellation_reason=None, _configuration=None):  # noqa: E501
        """Cancellation - a model defined in Swagger"""  # noqa: E501
        if _configuration is None:
            _configuration = Configuration()
        self._configuration = _configuration

        self._cancelled_quantity = None
        self._cancelled_timestamp = None
        self._cancellation_type = None
        self._cancellation_reason = None
        self.discriminator = None

        self.cancelled_quantity = cancelled_quantity
        self.cancelled_timestamp = cancelled_timestamp
        self.cancellation_type = cancellation_type
        if cancellation_reason is not None:
            self.cancellation_reason = cancellation_reason

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

        The number of items of this particular item which have been cancelled.  # noqa: E501

        :return: The cancelled_quantity of this Cancellation.  # noqa: E501
        :rtype: int
        """
        return self._cancelled_quantity

    @cancelled_quantity.setter
    def cancelled_quantity(self, cancelled_quantity):
        """Sets the cancelled_quantity of this Cancellation.

        The number of items of this particular item which have been cancelled.  # noqa: E501

        :param cancelled_quantity: The cancelled_quantity of this Cancellation.  # noqa: E501
        :type: int
        """
        if self._configuration.client_side_validation and cancelled_quantity is None:
            raise ValueError("Invalid value for `cancelled_quantity`, must not be `None`")  # noqa: E501
        if (self._configuration.client_side_validation and
                cancelled_quantity is not None and cancelled_quantity < 1):  # noqa: E501
            raise ValueError("Invalid value for `cancelled_quantity`, must be a value greater than or equal to `1`")  # noqa: E501

        self._cancelled_quantity = cancelled_quantity

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

        A date and time in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.  # noqa: E501

        :return: The cancelled_timestamp of this Cancellation.  # noqa: E501
        :rtype: str
        """
        return self._cancelled_timestamp

    @cancelled_timestamp.setter
    def cancelled_timestamp(self, cancelled_timestamp):
        """Sets the cancelled_timestamp of this Cancellation.

        A date and time in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) format.  # noqa: E501

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

        self._cancelled_timestamp = cancelled_timestamp

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

        The type of cancellation of the item in the shipment.  # noqa: E501

        :return: The cancellation_type of this Cancellation.  # noqa: E501
        :rtype: str
        """
        return self._cancellation_type

    @cancellation_type.setter
    def cancellation_type(self, cancellation_type):
        """Sets the cancellation_type of this Cancellation.

        The type of cancellation of the item in the shipment.  # noqa: E501

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

        self._cancellation_type = cancellation_type

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

        The reason for the cancellation of the shipment.  # noqa: E501

        :return: The cancellation_reason of this Cancellation.  # noqa: E501
        :rtype: str
        """
        return self._cancellation_reason

    @cancellation_reason.setter
    def cancellation_reason(self, cancellation_reason):
        """Sets the cancellation_reason of this Cancellation.

        The reason for the cancellation of the shipment.  # noqa: E501

        :param cancellation_reason: The cancellation_reason of this Cancellation.  # noqa: E501
        :type: str
        """

        self._cancellation_reason = cancellation_reason

    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(Cancellation, 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, Cancellation):
            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, Cancellation):
            return True

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