"""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_11 import (
    Bank11,
)
from visaacceptancemergedspec.models.card_10 import (
    Card10,
)
from visaacceptancemergedspec.models.e_wallet_9 import (
    EWallet9,
)
from visaacceptancemergedspec.models.options_1 import (
    Options1,
)
from visaacceptancemergedspec.models.payment_type import (
    PaymentType,
)


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

    Attributes:
        card (Card10): The model property of type Card10.
        bank (Bank11): The model property of type Bank11.
        e_wallet (EWallet9): The model property of type EWallet9.
        options (Options1): The model property of type Options1.
        payment_type (PaymentType): The model property of type PaymentType.
        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",
        "e_wallet": "eWallet",
        "options": "options",
        "payment_type": "paymentType",
    }

    _optionals = [
        "card",
        "bank",
        "e_wallet",
        "options",
        "payment_type",
    ]

    def __init__(
        self,
        card=APIHelper.SKIP,
        bank=APIHelper.SKIP,
        e_wallet=APIHelper.SKIP,
        options=APIHelper.SKIP,
        payment_type=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a PaymentInformation22 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 e_wallet is not APIHelper.SKIP:
            self.e_wallet = e_wallet
        if options is not APIHelper.SKIP:
            self.options = options
        if payment_type is not APIHelper.SKIP:
            self.payment_type = payment_type

        # 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 =\
            Card10.from_dictionary(
                dictionary.get("card"))\
                if "card" in dictionary.keys()\
                else APIHelper.SKIP
        bank =\
            Bank11.from_dictionary(
                dictionary.get("bank"))\
                if "bank" in dictionary.keys()\
                else APIHelper.SKIP
        e_wallet =\
            EWallet9.from_dictionary(
                dictionary.get("eWallet"))\
                if "eWallet" in dictionary.keys()\
                else APIHelper.SKIP
        options =\
            Options1.from_dictionary(
                dictionary.get("options"))\
                if "options" in dictionary.keys()\
                else APIHelper.SKIP
        payment_type =\
            PaymentType.from_dictionary(
                dictionary.get("paymentType"))\
                if "paymentType" 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,
                   e_wallet,
                   options,
                   payment_type,
                   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
        )
        _e_wallet=(
            self.e_wallet
            if hasattr(self, "e_wallet")
            else None
        )
        _options=(
            self.options
            if hasattr(self, "options")
            else None
        )
        _payment_type=(
            self.payment_type
            if hasattr(self, "payment_type")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"card={_card!r}, "
            f"bank={_bank!r}, "
            f"e_wallet={_e_wallet!r}, "
            f"options={_options!r}, "
            f"payment_type={_payment_type!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
        )
        _e_wallet=(
            self.e_wallet
            if hasattr(self, "e_wallet")
            else None
        )
        _options=(
            self.options
            if hasattr(self, "options")
            else None
        )
        _payment_type=(
            self.payment_type
            if hasattr(self, "payment_type")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"card={_card!s}, "
            f"bank={_bank!s}, "
            f"e_wallet={_e_wallet!s}, "
            f"options={_options!s}, "
            f"payment_type={_payment_type!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
