"""visaacceptancemergedspec.

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

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)
from visaacceptancemergedspec.models.bank_2 import (
    Bank2,
)
from visaacceptancemergedspec.models.card_4 import (
    Card4,
)
from visaacceptancemergedspec.models.customer import (
    Customer,
)
from visaacceptancemergedspec.models.e_wallet_2 import (
    EWallet2,
)
from visaacceptancemergedspec.models.fluid_data import (
    FluidData,
)
from visaacceptancemergedspec.models.instrument_identifier import (
    InstrumentIdentifier,
)
from visaacceptancemergedspec.models.legacy_token import (
    LegacyToken,
)
from visaacceptancemergedspec.models.payment_account_reference import (
    PaymentAccountReference,
)
from visaacceptancemergedspec.models.payment_instrument import (
    PaymentInstrument,
)
from visaacceptancemergedspec.models.payment_type_3 import (
    PaymentType3,
)
from visaacceptancemergedspec.models.shipping_address import (
    ShippingAddress,
)
from visaacceptancemergedspec.models.tokenized_card import (
    TokenizedCard,
)


class PaymentInformation5(object):
    """Implementation of the 'PaymentInformation5' model.

    Attributes:
        card (Card4): The model property of type Card4.
        bank (Bank2): The model property of type Bank2.
        tokenized_card (TokenizedCard): The model property of type TokenizedCard.
        fluid_data (FluidData): The model property of type FluidData.
        customer (Customer): The model property of type Customer.
        payment_instrument (PaymentInstrument): The model property of type
            PaymentInstrument.
        instrument_identifier (InstrumentIdentifier): The model property of type
            InstrumentIdentifier.
        shipping_address (ShippingAddress): The model property of type
            ShippingAddress.
        legacy_token (LegacyToken): The model property of type LegacyToken.
        payment_type (PaymentType3): The model property of type PaymentType3.
        e_wallet (EWallet2): The model property of type EWallet2.
        payment_account_reference (PaymentAccountReference): The model property of
            type PaymentAccountReference.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "card": "card",
        "bank": "bank",
        "tokenized_card": "tokenizedCard",
        "fluid_data": "fluidData",
        "customer": "customer",
        "payment_instrument": "paymentInstrument",
        "instrument_identifier": "instrumentIdentifier",
        "shipping_address": "shippingAddress",
        "legacy_token": "legacyToken",
        "payment_type": "paymentType",
        "e_wallet": "eWallet",
        "payment_account_reference": "paymentAccountReference",
    }

    _optionals = [
        "card",
        "bank",
        "tokenized_card",
        "fluid_data",
        "customer",
        "payment_instrument",
        "instrument_identifier",
        "shipping_address",
        "legacy_token",
        "payment_type",
        "e_wallet",
        "payment_account_reference",
    ]

    def __init__(
        self,
        card=APIHelper.SKIP,
        bank=APIHelper.SKIP,
        tokenized_card=APIHelper.SKIP,
        fluid_data=APIHelper.SKIP,
        customer=APIHelper.SKIP,
        payment_instrument=APIHelper.SKIP,
        instrument_identifier=APIHelper.SKIP,
        shipping_address=APIHelper.SKIP,
        legacy_token=APIHelper.SKIP,
        payment_type=APIHelper.SKIP,
        e_wallet=APIHelper.SKIP,
        payment_account_reference=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a PaymentInformation5 instance."""
        # Initialize members of the class
        if card is not APIHelper.SKIP:
            self.card = card
        if bank is not APIHelper.SKIP:
            self.bank = bank
        if tokenized_card is not APIHelper.SKIP:
            self.tokenized_card = tokenized_card
        if fluid_data is not APIHelper.SKIP:
            self.fluid_data = fluid_data
        if customer is not APIHelper.SKIP:
            self.customer = customer
        if payment_instrument is not APIHelper.SKIP:
            self.payment_instrument = payment_instrument
        if instrument_identifier is not APIHelper.SKIP:
            self.instrument_identifier = instrument_identifier
        if shipping_address is not APIHelper.SKIP:
            self.shipping_address = shipping_address
        if legacy_token is not APIHelper.SKIP:
            self.legacy_token = legacy_token
        if payment_type is not APIHelper.SKIP:
            self.payment_type = payment_type
        if e_wallet is not APIHelper.SKIP:
            self.e_wallet = e_wallet
        if payment_account_reference is not APIHelper.SKIP:
            self.payment_account_reference = payment_account_reference

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @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
        card =\
            Card4.from_dictionary(
                dictionary.get("card"))\
                if "card" in dictionary.keys()\
                else APIHelper.SKIP
        bank =\
            Bank2.from_dictionary(
                dictionary.get("bank"))\
                if "bank" in dictionary.keys()\
                else APIHelper.SKIP
        tokenized_card =\
            TokenizedCard.from_dictionary(
                dictionary.get("tokenizedCard"))\
                if "tokenizedCard" in dictionary.keys()\
                else APIHelper.SKIP
        fluid_data =\
            FluidData.from_dictionary(
                dictionary.get("fluidData"))\
                if "fluidData" in dictionary.keys()\
                else APIHelper.SKIP
        customer =\
            Customer.from_dictionary(
                dictionary.get("customer"))\
                if "customer" in dictionary.keys()\
                else APIHelper.SKIP
        payment_instrument =\
            PaymentInstrument.from_dictionary(
                dictionary.get("paymentInstrument"))\
                if "paymentInstrument" in dictionary.keys()\
                else APIHelper.SKIP
        instrument_identifier =\
            InstrumentIdentifier.from_dictionary(
                dictionary.get("instrumentIdentifier"))\
                if "instrumentIdentifier" in dictionary.keys()\
                else APIHelper.SKIP
        shipping_address =\
            ShippingAddress.from_dictionary(
                dictionary.get("shippingAddress"))\
                if "shippingAddress" in dictionary.keys()\
                else APIHelper.SKIP
        legacy_token =\
            LegacyToken.from_dictionary(
                dictionary.get("legacyToken"))\
                if "legacyToken" in dictionary.keys()\
                else APIHelper.SKIP
        payment_type =\
            PaymentType3.from_dictionary(
                dictionary.get("paymentType"))\
                if "paymentType" in dictionary.keys()\
                else APIHelper.SKIP
        e_wallet =\
            EWallet2.from_dictionary(
                dictionary.get("eWallet"))\
                if "eWallet" in dictionary.keys()\
                else APIHelper.SKIP
        payment_account_reference =\
            PaymentAccountReference.from_dictionary(
                dictionary.get("paymentAccountReference"))\
                if "paymentAccountReference" in dictionary.keys()\
                else APIHelper.SKIP

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(card,
                   bank,
                   tokenized_card,
                   fluid_data,
                   customer,
                   payment_instrument,
                   instrument_identifier,
                   shipping_address,
                   legacy_token,
                   payment_type,
                   e_wallet,
                   payment_account_reference,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _card=(
            self.card
            if hasattr(self, "card")
            else None
        )
        _bank=(
            self.bank
            if hasattr(self, "bank")
            else None
        )
        _tokenized_card=(
            self.tokenized_card
            if hasattr(self, "tokenized_card")
            else None
        )
        _fluid_data=(
            self.fluid_data
            if hasattr(self, "fluid_data")
            else None
        )
        _customer=(
            self.customer
            if hasattr(self, "customer")
            else None
        )
        _payment_instrument=(
            self.payment_instrument
            if hasattr(self, "payment_instrument")
            else None
        )
        _instrument_identifier=(
            self.instrument_identifier
            if hasattr(self, "instrument_identifier")
            else None
        )
        _shipping_address=(
            self.shipping_address
            if hasattr(self, "shipping_address")
            else None
        )
        _legacy_token=(
            self.legacy_token
            if hasattr(self, "legacy_token")
            else None
        )
        _payment_type=(
            self.payment_type
            if hasattr(self, "payment_type")
            else None
        )
        _e_wallet=(
            self.e_wallet
            if hasattr(self, "e_wallet")
            else None
        )
        _payment_account_reference=(
            self.payment_account_reference
            if hasattr(self, "payment_account_reference")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"card={_card!r}, "
            f"bank={_bank!r}, "
            f"tokenized_card={_tokenized_card!r}, "
            f"fluid_data={_fluid_data!r}, "
            f"customer={_customer!r}, "
            f"payment_instrument={_payment_instrument!r}, "
            f"instrument_identifier={_instrument_identifier!r}, "
            f"shipping_address={_shipping_address!r}, "
            f"legacy_token={_legacy_token!r}, "
            f"payment_type={_payment_type!r}, "
            f"e_wallet={_e_wallet!r}, "
            f"payment_account_reference={_payment_account_reference!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _card=(
            self.card
            if hasattr(self, "card")
            else None
        )
        _bank=(
            self.bank
            if hasattr(self, "bank")
            else None
        )
        _tokenized_card=(
            self.tokenized_card
            if hasattr(self, "tokenized_card")
            else None
        )
        _fluid_data=(
            self.fluid_data
            if hasattr(self, "fluid_data")
            else None
        )
        _customer=(
            self.customer
            if hasattr(self, "customer")
            else None
        )
        _payment_instrument=(
            self.payment_instrument
            if hasattr(self, "payment_instrument")
            else None
        )
        _instrument_identifier=(
            self.instrument_identifier
            if hasattr(self, "instrument_identifier")
            else None
        )
        _shipping_address=(
            self.shipping_address
            if hasattr(self, "shipping_address")
            else None
        )
        _legacy_token=(
            self.legacy_token
            if hasattr(self, "legacy_token")
            else None
        )
        _payment_type=(
            self.payment_type
            if hasattr(self, "payment_type")
            else None
        )
        _e_wallet=(
            self.e_wallet
            if hasattr(self, "e_wallet")
            else None
        )
        _payment_account_reference=(
            self.payment_account_reference
            if hasattr(self, "payment_account_reference")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"card={_card!s}, "
            f"bank={_bank!s}, "
            f"tokenized_card={_tokenized_card!s}, "
            f"fluid_data={_fluid_data!s}, "
            f"customer={_customer!s}, "
            f"payment_instrument={_payment_instrument!s}, "
            f"instrument_identifier={_instrument_identifier!s}, "
            f"shipping_address={_shipping_address!s}, "
            f"legacy_token={_legacy_token!s}, "
            f"payment_type={_payment_type!s}, "
            f"e_wallet={_e_wallet!s}, "
            f"payment_account_reference={_payment_account_reference!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
