# coding: utf-8

"""
    The Selling Partner API for Finances

    The Selling Partner API for Finances helps you obtain financial information relevant to a seller's business. You can obtain financial events for a given order or date range without having to wait until a statement period closes.

    The version of the OpenAPI document: 2024-06-19
    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 Transaction(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 = {
        'selling_partner_metadata': 'SellingPartnerMetadata',
        'related_identifiers': 'List[RelatedIdentifier]',
        'transaction_type': 'str',
        'transaction_id': 'str',
        'transaction_status': 'str',
        'description': 'str',
        'posted_date': 'datetime',
        'total_amount': 'Currency',
        'marketplace_details': 'MarketplaceDetails',
        'items': 'List[Item]',
        'contexts': 'List[Context]',
        'breakdowns': 'List[Breakdown]',
    }

    attribute_map = {
        'selling_partner_metadata': 'sellingPartnerMetadata',
        'related_identifiers': 'relatedIdentifiers',
        'transaction_type': 'transactionType',
        'transaction_id': 'transactionId',
        'transaction_status': 'transactionStatus',
        'description': 'description',
        'posted_date': 'postedDate',
        'total_amount': 'totalAmount',
        'marketplace_details': 'marketplaceDetails',
        'items': 'items',
        'contexts': 'contexts',
        'breakdowns': 'breakdowns',
    }

    def __init__(self, selling_partner_metadata=None, related_identifiers=None, transaction_type=None, transaction_id=None, transaction_status=None, description=None, posted_date=None, total_amount=None, marketplace_details=None, items=None, contexts=None, breakdowns=None, _configuration=None):  # noqa: E501
        """Transaction - a model defined in Swagger"""  # noqa: E501
        if _configuration is None:
            _configuration = Configuration()
        self._configuration = _configuration

        self._selling_partner_metadata = None
        self._related_identifiers = None
        self._transaction_type = None
        self._transaction_id = None
        self._transaction_status = None
        self._description = None
        self._posted_date = None
        self._total_amount = None
        self._marketplace_details = None
        self._items = None
        self._contexts = None
        self._breakdowns = None
        self.discriminator = None

        if selling_partner_metadata is not None:
            self.selling_partner_metadata = selling_partner_metadata
        if related_identifiers is not None:
            self.related_identifiers = related_identifiers
        if transaction_type is not None:
            self.transaction_type = transaction_type
        if transaction_id is not None:
            self.transaction_id = transaction_id
        if transaction_status is not None:
            self.transaction_status = transaction_status
        if description is not None:
            self.description = description
        if posted_date is not None:
            self.posted_date = posted_date
        if total_amount is not None:
            self.total_amount = total_amount
        if marketplace_details is not None:
            self.marketplace_details = marketplace_details
        if items is not None:
            self.items = items
        if contexts is not None:
            self.contexts = contexts
        if breakdowns is not None:
            self.breakdowns = breakdowns

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


        :return: The selling_partner_metadata of this Transaction.  # noqa: E501
        :rtype: SellingPartnerMetadata
        """
        return self._selling_partner_metadata

    @selling_partner_metadata.setter
    def selling_partner_metadata(self, selling_partner_metadata):
        """Sets the selling_partner_metadata of this Transaction.


        :param selling_partner_metadata: The selling_partner_metadata of this Transaction.  # noqa: E501
        :type: SellingPartnerMetadata
        """

        self._selling_partner_metadata = selling_partner_metadata

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

        Related business identifiers of the transaction.  # noqa: E501

        :return: The related_identifiers of this Transaction.  # noqa: E501
        :rtype: List[RelatedIdentifier]
        """
        return self._related_identifiers

    @related_identifiers.setter
    def related_identifiers(self, related_identifiers):
        """Sets the related_identifiers of this Transaction.

        Related business identifiers of the transaction.  # noqa: E501

        :param related_identifiers: The related_identifiers of this Transaction.  # noqa: E501
        :type: List[RelatedIdentifier]
        """

        self._related_identifiers = related_identifiers

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

        The type of transaction.  Possible values:  * Shipment  # noqa: E501

        :return: The transaction_type of this Transaction.  # noqa: E501
        :rtype: str
        """
        return self._transaction_type

    @transaction_type.setter
    def transaction_type(self, transaction_type):
        """Sets the transaction_type of this Transaction.

        The type of transaction.  Possible values:  * Shipment  # noqa: E501

        :param transaction_type: The transaction_type of this Transaction.  # noqa: E501
        :type: str
        """

        self._transaction_type = transaction_type

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

        The unique identifier for the transaction.  # noqa: E501

        :return: The transaction_id of this Transaction.  # noqa: E501
        :rtype: str
        """
        return self._transaction_id

    @transaction_id.setter
    def transaction_id(self, transaction_id):
        """Sets the transaction_id of this Transaction.

        The unique identifier for the transaction.  # noqa: E501

        :param transaction_id: The transaction_id of this Transaction.  # noqa: E501
        :type: str
        """

        self._transaction_id = transaction_id

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

        The status of the transaction.  **Possible values:**  * `DEFERRED`: the transaction is currently deferred. * `RELEASED`: the transaction is currently released. * `DEFERRED_RELEASED`: the transaction was deferred in the past, but is now released. The status of a deferred transaction is updated to `DEFERRED_RELEASED` when the transaction is released.  # noqa: E501

        :return: The transaction_status of this Transaction.  # noqa: E501
        :rtype: str
        """
        return self._transaction_status

    @transaction_status.setter
    def transaction_status(self, transaction_status):
        """Sets the transaction_status of this Transaction.

        The status of the transaction.  **Possible values:**  * `DEFERRED`: the transaction is currently deferred. * `RELEASED`: the transaction is currently released. * `DEFERRED_RELEASED`: the transaction was deferred in the past, but is now released. The status of a deferred transaction is updated to `DEFERRED_RELEASED` when the transaction is released.  # noqa: E501

        :param transaction_status: The transaction_status of this Transaction.  # noqa: E501
        :type: str
        """

        self._transaction_status = transaction_status

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

        Describes the reasons for the transaction.  Example: 'Order Payment','Refund Order'  # noqa: E501

        :return: The description of this Transaction.  # noqa: E501
        :rtype: str
        """
        return self._description

    @description.setter
    def description(self, description):
        """Sets the description of this Transaction.

        Describes the reasons for the transaction.  Example: 'Order Payment','Refund Order'  # noqa: E501

        :param description: The description of this Transaction.  # noqa: E501
        :type: str
        """

        self._description = description

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

        Fields with a schema type of date are in ISO 8601 date time format (for example GroupBeginDate).  # noqa: E501

        :return: The posted_date of this Transaction.  # noqa: E501
        :rtype: datetime
        """
        return self._posted_date

    @posted_date.setter
    def posted_date(self, posted_date):
        """Sets the posted_date of this Transaction.

        Fields with a schema type of date are in ISO 8601 date time format (for example GroupBeginDate).  # noqa: E501

        :param posted_date: The posted_date of this Transaction.  # noqa: E501
        :type: datetime
        """

        self._posted_date = posted_date

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


        :return: The total_amount of this Transaction.  # noqa: E501
        :rtype: Currency
        """
        return self._total_amount

    @total_amount.setter
    def total_amount(self, total_amount):
        """Sets the total_amount of this Transaction.


        :param total_amount: The total_amount of this Transaction.  # noqa: E501
        :type: Currency
        """

        self._total_amount = total_amount

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


        :return: The marketplace_details of this Transaction.  # noqa: E501
        :rtype: MarketplaceDetails
        """
        return self._marketplace_details

    @marketplace_details.setter
    def marketplace_details(self, marketplace_details):
        """Sets the marketplace_details of this Transaction.


        :param marketplace_details: The marketplace_details of this Transaction.  # noqa: E501
        :type: MarketplaceDetails
        """

        self._marketplace_details = marketplace_details

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

        List of items in the transaction  # noqa: E501

        :return: The items of this Transaction.  # noqa: E501
        :rtype: List[Item]
        """
        return self._items

    @items.setter
    def items(self, items):
        """Sets the items of this Transaction.

        List of items in the transaction  # noqa: E501

        :param items: The items of this Transaction.  # noqa: E501
        :type: List[Item]
        """

        self._items = items

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

        List of additional Information about the item.  # noqa: E501

        :return: The contexts of this Transaction.  # noqa: E501
        :rtype: List[Context]
        """
        return self._contexts

    @contexts.setter
    def contexts(self, contexts):
        """Sets the contexts of this Transaction.

        List of additional Information about the item.  # noqa: E501

        :param contexts: The contexts of this Transaction.  # noqa: E501
        :type: List[Context]
        """

        self._contexts = contexts

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

        A list of breakdowns that detail how the total amount is calculated for the transaction.  # noqa: E501

        :return: The breakdowns of this Transaction.  # noqa: E501
        :rtype: List[Breakdown]
        """
        return self._breakdowns

    @breakdowns.setter
    def breakdowns(self, breakdowns):
        """Sets the breakdowns of this Transaction.

        A list of breakdowns that detail how the total amount is calculated for the transaction.  # noqa: E501

        :param breakdowns: The breakdowns of this Transaction.  # noqa: E501
        :type: List[Breakdown]
        """

        self._breakdowns = breakdowns

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

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