"""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.account_features_2 import (
    AccountFeatures2,
)
from visaacceptancemergedspec.models.bank_13 import (
    Bank13,
)
from visaacceptancemergedspec.models.brand_24 import (
    Brand24,
)
from visaacceptancemergedspec.models.card_105 import (
    Card105,
)
from visaacceptancemergedspec.models.customer_42 import (
    Customer42,
)
from visaacceptancemergedspec.models.features_24 import (
    Features24,
)
from visaacceptancemergedspec.models.fluid_data_4 import (
    FluidData4,
)
from visaacceptancemergedspec.models.instrument_identifier_27 import (
    InstrumentIdentifier27,
)
from visaacceptancemergedspec.models.invoice import (
    Invoice,
)
from visaacceptancemergedspec.models.issuer_information_30 import (
    IssuerInformation30,
)
from visaacceptancemergedspec.models.network_24 import (
    Network24,
)
from visaacceptancemergedspec.models.payment_instrument_4 import (
    PaymentInstrument4,
)
from visaacceptancemergedspec.models.payment_type_22 import (
    PaymentType22,
)
from visaacceptancemergedspec.models.shipping_address_4 import (
    ShippingAddress4,
)


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

    Attributes:
        payment_type (PaymentType22): The model property of type PaymentType22.
        customer (Customer42): The model property of type Customer42.
        card (Card105): The model property of type Card105.
        brands (List[Brand24]): This array contains the supported brands.
        features (Features24): The model property of type Features24.
        invoice (Invoice): The model property of type Invoice.
        network (Network24): The model property of type Network24.
        issuer_information (IssuerInformation30): The model property of type
            IssuerInformation30.
        bank (Bank13): The model property of type Bank13.
        account_features (AccountFeatures2): The model property of type
            AccountFeatures2.
        payment_instrument (PaymentInstrument4): The model property of type
            PaymentInstrument4.
        instrument_identifier (InstrumentIdentifier27): The model property of type
            InstrumentIdentifier27.
        shipping_address (ShippingAddress4): The model property of type
            ShippingAddress4.
        fluid_data (FluidData4): The model property of type FluidData4.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "payment_type": "paymentType",
        "customer": "customer",
        "card": "card",
        "brands": "brands",
        "features": "features",
        "invoice": "invoice",
        "network": "network",
        "issuer_information": "issuerInformation",
        "bank": "bank",
        "account_features": "accountFeatures",
        "payment_instrument": "paymentInstrument",
        "instrument_identifier": "instrumentIdentifier",
        "shipping_address": "shippingAddress",
        "fluid_data": "fluidData",
    }

    _optionals = [
        "payment_type",
        "customer",
        "card",
        "brands",
        "features",
        "invoice",
        "network",
        "issuer_information",
        "bank",
        "account_features",
        "payment_instrument",
        "instrument_identifier",
        "shipping_address",
        "fluid_data",
    ]

    def __init__(
        self,
        payment_type=APIHelper.SKIP,
        customer=APIHelper.SKIP,
        card=APIHelper.SKIP,
        brands=APIHelper.SKIP,
        features=APIHelper.SKIP,
        invoice=APIHelper.SKIP,
        network=APIHelper.SKIP,
        issuer_information=APIHelper.SKIP,
        bank=APIHelper.SKIP,
        account_features=APIHelper.SKIP,
        payment_instrument=APIHelper.SKIP,
        instrument_identifier=APIHelper.SKIP,
        shipping_address=APIHelper.SKIP,
        fluid_data=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a PaymentInformation31 instance."""
        # Initialize members of the class
        if payment_type is not APIHelper.SKIP:
            self.payment_type = payment_type
        if customer is not APIHelper.SKIP:
            self.customer = customer
        if card is not APIHelper.SKIP:
            self.card = card
        if brands is not APIHelper.SKIP:
            self.brands = brands
        if features is not APIHelper.SKIP:
            self.features = features
        if invoice is not APIHelper.SKIP:
            self.invoice = invoice
        if network is not APIHelper.SKIP:
            self.network = network
        if issuer_information is not APIHelper.SKIP:
            self.issuer_information = issuer_information
        if bank is not APIHelper.SKIP:
            self.bank = bank
        if account_features is not APIHelper.SKIP:
            self.account_features = account_features
        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 fluid_data is not APIHelper.SKIP:
            self.fluid_data = fluid_data

        # 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
        payment_type =\
            PaymentType22.from_dictionary(
                dictionary.get("paymentType"))\
                if "paymentType" in dictionary.keys()\
                else APIHelper.SKIP
        customer =\
            Customer42.from_dictionary(
                dictionary.get("customer"))\
                if "customer" in dictionary.keys()\
                else APIHelper.SKIP
        card =\
            Card105.from_dictionary(
                dictionary.get("card"))\
                if "card" in dictionary.keys()\
                else APIHelper.SKIP
        brands = None
        if dictionary.get("brands") is not None:
            brands = [
                Brand24.from_dictionary(x)
                    for x in dictionary.get("brands")
            ]
        else:
            brands = APIHelper.SKIP
        features =\
            Features24.from_dictionary(
                dictionary.get("features"))\
                if "features" in dictionary.keys()\
                else APIHelper.SKIP
        invoice =\
            Invoice.from_dictionary(
                dictionary.get("invoice"))\
                if "invoice" in dictionary.keys()\
                else APIHelper.SKIP
        network =\
            Network24.from_dictionary(
                dictionary.get("network"))\
                if "network" in dictionary.keys()\
                else APIHelper.SKIP
        issuer_information =\
            IssuerInformation30.from_dictionary(
                dictionary.get("issuerInformation"))\
                if "issuerInformation" in dictionary.keys()\
                else APIHelper.SKIP
        bank =\
            Bank13.from_dictionary(
                dictionary.get("bank"))\
                if "bank" in dictionary.keys()\
                else APIHelper.SKIP
        account_features =\
            AccountFeatures2.from_dictionary(
                dictionary.get("accountFeatures"))\
                if "accountFeatures" in dictionary.keys()\
                else APIHelper.SKIP
        payment_instrument =\
            PaymentInstrument4.from_dictionary(
                dictionary.get("paymentInstrument"))\
                if "paymentInstrument" in dictionary.keys()\
                else APIHelper.SKIP
        instrument_identifier =\
            InstrumentIdentifier27.from_dictionary(
                dictionary.get("instrumentIdentifier"))\
                if "instrumentIdentifier" in dictionary.keys()\
                else APIHelper.SKIP
        shipping_address =\
            ShippingAddress4.from_dictionary(
                dictionary.get("shippingAddress"))\
                if "shippingAddress" in dictionary.keys()\
                else APIHelper.SKIP
        fluid_data =\
            FluidData4.from_dictionary(
                dictionary.get("fluidData"))\
                if "fluidData" 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(payment_type,
                   customer,
                   card,
                   brands,
                   features,
                   invoice,
                   network,
                   issuer_information,
                   bank,
                   account_features,
                   payment_instrument,
                   instrument_identifier,
                   shipping_address,
                   fluid_data,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _payment_type=(
            self.payment_type
            if hasattr(self, "payment_type")
            else None
        )
        _customer=(
            self.customer
            if hasattr(self, "customer")
            else None
        )
        _card=(
            self.card
            if hasattr(self, "card")
            else None
        )
        _brands=(
            self.brands
            if hasattr(self, "brands")
            else None
        )
        _features=(
            self.features
            if hasattr(self, "features")
            else None
        )
        _invoice=(
            self.invoice
            if hasattr(self, "invoice")
            else None
        )
        _network=(
            self.network
            if hasattr(self, "network")
            else None
        )
        _issuer_information=(
            self.issuer_information
            if hasattr(self, "issuer_information")
            else None
        )
        _bank=(
            self.bank
            if hasattr(self, "bank")
            else None
        )
        _account_features=(
            self.account_features
            if hasattr(self, "account_features")
            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
        )
        _fluid_data=(
            self.fluid_data
            if hasattr(self, "fluid_data")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"payment_type={_payment_type!r}, "
            f"customer={_customer!r}, "
            f"card={_card!r}, "
            f"brands={_brands!r}, "
            f"features={_features!r}, "
            f"invoice={_invoice!r}, "
            f"network={_network!r}, "
            f"issuer_information={_issuer_information!r}, "
            f"bank={_bank!r}, "
            f"account_features={_account_features!r}, "
            f"payment_instrument={_payment_instrument!r}, "
            f"instrument_identifier={_instrument_identifier!r}, "
            f"shipping_address={_shipping_address!r}, "
            f"fluid_data={_fluid_data!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _payment_type=(
            self.payment_type
            if hasattr(self, "payment_type")
            else None
        )
        _customer=(
            self.customer
            if hasattr(self, "customer")
            else None
        )
        _card=(
            self.card
            if hasattr(self, "card")
            else None
        )
        _brands=(
            self.brands
            if hasattr(self, "brands")
            else None
        )
        _features=(
            self.features
            if hasattr(self, "features")
            else None
        )
        _invoice=(
            self.invoice
            if hasattr(self, "invoice")
            else None
        )
        _network=(
            self.network
            if hasattr(self, "network")
            else None
        )
        _issuer_information=(
            self.issuer_information
            if hasattr(self, "issuer_information")
            else None
        )
        _bank=(
            self.bank
            if hasattr(self, "bank")
            else None
        )
        _account_features=(
            self.account_features
            if hasattr(self, "account_features")
            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
        )
        _fluid_data=(
            self.fluid_data
            if hasattr(self, "fluid_data")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"payment_type={_payment_type!s}, "
            f"customer={_customer!s}, "
            f"card={_card!s}, "
            f"brands={_brands!s}, "
            f"features={_features!s}, "
            f"invoice={_invoice!s}, "
            f"network={_network!s}, "
            f"issuer_information={_issuer_information!s}, "
            f"bank={_bank!s}, "
            f"account_features={_account_features!s}, "
            f"payment_instrument={_payment_instrument!s}, "
            f"instrument_identifier={_instrument_identifier!s}, "
            f"shipping_address={_shipping_address!s}, "
            f"fluid_data={_fluid_data!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
