"""paypalserversdk.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from paypalserversdk.api_helper import APIHelper
from paypalserversdk.models.auction_information import (
    AuctionInformation,
)
from paypalserversdk.models.cart_information import (
    CartInformation,
)
from paypalserversdk.models.incentive_information import (
    IncentiveInformation,
)
from paypalserversdk.models.payer_information import (
    PayerInformation,
)
from paypalserversdk.models.shipping_information import (
    ShippingInformation,
)
from paypalserversdk.models.store_information import (
    StoreInformation,
)
from paypalserversdk.models.transaction_information import (
    TransactionInformation,
)


class TransactionDetails(object):
    """Implementation of the 'Transaction Details' model.

    The transaction details.

    Attributes:
        transaction_info (TransactionInformation): The transaction information.
        payer_info (PayerInformation): The payer information.
        shipping_info (ShippingInformation): The shipping information.
        cart_info (CartInformation): The cart information.
        store_info (StoreInformation): The store information.
        auction_info (AuctionInformation): The auction information.
        incentive_info (IncentiveInformation): The incentive details.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "transaction_info": "transaction_info",
        "payer_info": "payer_info",
        "shipping_info": "shipping_info",
        "cart_info": "cart_info",
        "store_info": "store_info",
        "auction_info": "auction_info",
        "incentive_info": "incentive_info",
    }

    _optionals = [
        "transaction_info",
        "payer_info",
        "shipping_info",
        "cart_info",
        "store_info",
        "auction_info",
        "incentive_info",
    ]

    def __init__(
        self,
        transaction_info=APIHelper.SKIP,
        payer_info=APIHelper.SKIP,
        shipping_info=APIHelper.SKIP,
        cart_info=APIHelper.SKIP,
        store_info=APIHelper.SKIP,
        auction_info=APIHelper.SKIP,
        incentive_info=APIHelper.SKIP):
        """Initialize a TransactionDetails instance."""
        # Initialize members of the class
        if transaction_info is not APIHelper.SKIP:
            self.transaction_info = transaction_info
        if payer_info is not APIHelper.SKIP:
            self.payer_info = payer_info
        if shipping_info is not APIHelper.SKIP:
            self.shipping_info = shipping_info
        if cart_info is not APIHelper.SKIP:
            self.cart_info = cart_info
        if store_info is not APIHelper.SKIP:
            self.store_info = store_info
        if auction_info is not APIHelper.SKIP:
            self.auction_info = auction_info
        if incentive_info is not APIHelper.SKIP:
            self.incentive_info = incentive_info

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        transaction_info =\
            TransactionInformation.from_dictionary(
                dictionary.get("transaction_info"))\
                if "transaction_info" in dictionary.keys()\
                else APIHelper.SKIP
        payer_info =\
            PayerInformation.from_dictionary(
                dictionary.get("payer_info"))\
                if "payer_info" in dictionary.keys()\
                else APIHelper.SKIP
        shipping_info =\
            ShippingInformation.from_dictionary(
                dictionary.get("shipping_info"))\
                if "shipping_info" in dictionary.keys()\
                else APIHelper.SKIP
        cart_info =\
            CartInformation.from_dictionary(
                dictionary.get("cart_info"))\
                if "cart_info" in dictionary.keys()\
                else APIHelper.SKIP
        store_info =\
            StoreInformation.from_dictionary(
                dictionary.get("store_info"))\
                if "store_info" in dictionary.keys()\
                else APIHelper.SKIP
        auction_info =\
            AuctionInformation.from_dictionary(
                dictionary.get("auction_info"))\
                if "auction_info" in dictionary.keys()\
                else APIHelper.SKIP
        incentive_info =\
            IncentiveInformation.from_dictionary(
                dictionary.get("incentive_info"))\
                if "incentive_info" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(transaction_info,
                   payer_info,
                   shipping_info,
                   cart_info,
                   store_info,
                   auction_info,
                   incentive_info)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _transaction_info=(
            self.transaction_info
            if hasattr(self, "transaction_info")
            else None
        )
        _payer_info=(
            self.payer_info
            if hasattr(self, "payer_info")
            else None
        )
        _shipping_info=(
            self.shipping_info
            if hasattr(self, "shipping_info")
            else None
        )
        _cart_info=(
            self.cart_info
            if hasattr(self, "cart_info")
            else None
        )
        _store_info=(
            self.store_info
            if hasattr(self, "store_info")
            else None
        )
        _auction_info=(
            self.auction_info
            if hasattr(self, "auction_info")
            else None
        )
        _incentive_info=(
            self.incentive_info
            if hasattr(self, "incentive_info")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"transaction_info={_transaction_info!r}, "
            f"payer_info={_payer_info!r}, "
            f"shipping_info={_shipping_info!r}, "
            f"cart_info={_cart_info!r}, "
            f"store_info={_store_info!r}, "
            f"auction_info={_auction_info!r}, "
            f"incentive_info={_incentive_info!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _transaction_info=(
            self.transaction_info
            if hasattr(self, "transaction_info")
            else None
        )
        _payer_info=(
            self.payer_info
            if hasattr(self, "payer_info")
            else None
        )
        _shipping_info=(
            self.shipping_info
            if hasattr(self, "shipping_info")
            else None
        )
        _cart_info=(
            self.cart_info
            if hasattr(self, "cart_info")
            else None
        )
        _store_info=(
            self.store_info
            if hasattr(self, "store_info")
            else None
        )
        _auction_info=(
            self.auction_info
            if hasattr(self, "auction_info")
            else None
        )
        _incentive_info=(
            self.incentive_info
            if hasattr(self, "incentive_info")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"transaction_info={_transaction_info!s}, "
            f"payer_info={_payer_info!s}, "
            f"shipping_info={_shipping_info!s}, "
            f"cart_info={_cart_info!s}, "
            f"store_info={_store_info!s}, "
            f"auction_info={_auction_info!s}, "
            f"incentive_info={_incentive_info!s}, "
            f")"
        )
