"""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_account import (
    BankAccount,
)
from visaacceptancemergedspec.models.bill_to_15 import (
    BillTo15,
)
from visaacceptancemergedspec.models.buyer_information_13 import (
    BuyerInformation13,
)
from visaacceptancemergedspec.models.card_12 import (
    Card12,
)
from visaacceptancemergedspec.models.embedded_9 import (
    Embedded9,
)
from visaacceptancemergedspec.models.instrument_identifier_10 import (
    InstrumentIdentifier10,
)
from visaacceptancemergedspec.models.links_20 import (
    Links20,
)
from visaacceptancemergedspec.models.merchant_information_18 import (
    MerchantInformation18,
)
from visaacceptancemergedspec.models.metadata_1 import (
    Metadata1,
)
from visaacceptancemergedspec.models.tms_payment_instrument_processing_info import (
    TmsPaymentInstrumentProcessingInfo,
)


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

    Attributes:
        links (Links20): The model property of type Links20.
        id (str): The Id of the Payment Instrument Token.
        object (str): The type.  Possible Values: - paymentInstrument
        default (bool): Flag that indicates whether customer payment instrument is
            the dafault. Possible Values:  - `true`: Payment instrument is customer's
            default.  - `false`: Payment instrument is not customer's default.
        state (str): Issuers state for the card number. Possible Values: - ACTIVE -
            CLOSED : The account has been closed.
        mtype (str): The type of Payment Instrument. Possible Values: - cardHash
        bank_account (BankAccount): The model property of type BankAccount.
        card (Card12): The model property of type Card12.
        buyer_information (BuyerInformation13): The model property of type
            BuyerInformation13.
        bill_to (BillTo15): The model property of type BillTo15.
        processing_information (TmsPaymentInstrumentProcessingInfo): The model
            property of type TmsPaymentInstrumentProcessingInfo.
        merchant_information (MerchantInformation18): The model property of type
            MerchantInformation18.
        instrument_identifier (InstrumentIdentifier10): The model property of type
            InstrumentIdentifier10.
        metadata (Metadata1): The model property of type Metadata1.
        embedded (Embedded9): The model property of type Embedded9.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "links": "_links",
        "id": "id",
        "object": "object",
        "default": "default",
        "state": "state",
        "mtype": "type",
        "bank_account": "bankAccount",
        "card": "card",
        "buyer_information": "buyerInformation",
        "bill_to": "billTo",
        "processing_information": "processingInformation",
        "merchant_information": "merchantInformation",
        "instrument_identifier": "instrumentIdentifier",
        "metadata": "metadata",
        "embedded": "_embedded",
    }

    _optionals = [
        "links",
        "id",
        "object",
        "default",
        "state",
        "mtype",
        "bank_account",
        "card",
        "buyer_information",
        "bill_to",
        "processing_information",
        "merchant_information",
        "instrument_identifier",
        "metadata",
        "embedded",
    ]

    def __init__(
        self,
        links=APIHelper.SKIP,
        id=APIHelper.SKIP,
        object=APIHelper.SKIP,
        default=APIHelper.SKIP,
        state=APIHelper.SKIP,
        mtype=APIHelper.SKIP,
        bank_account=APIHelper.SKIP,
        card=APIHelper.SKIP,
        buyer_information=APIHelper.SKIP,
        bill_to=APIHelper.SKIP,
        processing_information=APIHelper.SKIP,
        merchant_information=APIHelper.SKIP,
        instrument_identifier=APIHelper.SKIP,
        metadata=APIHelper.SKIP,
        embedded=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a PostCustomerPaymentInstrumentResponse instance."""
        # Initialize members of the class
        if links is not APIHelper.SKIP:
            self.links = links
        if id is not APIHelper.SKIP:
            self.id = id
        if object is not APIHelper.SKIP:
            self.object = object
        if default is not APIHelper.SKIP:
            self.default = default
        if state is not APIHelper.SKIP:
            self.state = state
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype
        if bank_account is not APIHelper.SKIP:
            self.bank_account = bank_account
        if card is not APIHelper.SKIP:
            self.card = card
        if buyer_information is not APIHelper.SKIP:
            self.buyer_information = buyer_information
        if bill_to is not APIHelper.SKIP:
            self.bill_to = bill_to
        if processing_information is not APIHelper.SKIP:
            self.processing_information = processing_information
        if merchant_information is not APIHelper.SKIP:
            self.merchant_information = merchant_information
        if instrument_identifier is not APIHelper.SKIP:
            self.instrument_identifier = instrument_identifier
        if metadata is not APIHelper.SKIP:
            self.metadata = metadata
        if embedded is not APIHelper.SKIP:
            self.embedded = embedded

        # 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
        links =\
            Links20.from_dictionary(
                dictionary.get("_links"))\
                if "_links" in dictionary.keys()\
                else APIHelper.SKIP
        id =\
            dictionary.get("id")\
            if dictionary.get("id")\
                else APIHelper.SKIP
        object =\
            dictionary.get("object")\
            if dictionary.get("object")\
                else APIHelper.SKIP
        default =\
            dictionary.get("default")\
            if "default" in dictionary.keys()\
                else APIHelper.SKIP
        state =\
            dictionary.get("state")\
            if dictionary.get("state")\
                else APIHelper.SKIP
        mtype =\
            dictionary.get("type")\
            if dictionary.get("type")\
                else APIHelper.SKIP
        bank_account =\
            BankAccount.from_dictionary(
                dictionary.get("bankAccount"))\
                if "bankAccount" in dictionary.keys()\
                else APIHelper.SKIP
        card =\
            Card12.from_dictionary(
                dictionary.get("card"))\
                if "card" in dictionary.keys()\
                else APIHelper.SKIP
        buyer_information =\
            BuyerInformation13.from_dictionary(
                dictionary.get("buyerInformation"))\
                if "buyerInformation" in dictionary.keys()\
                else APIHelper.SKIP
        bill_to =\
            BillTo15.from_dictionary(
                dictionary.get("billTo"))\
                if "billTo" in dictionary.keys()\
                else APIHelper.SKIP
        processing_information =\
            TmsPaymentInstrumentProcessingInfo.from_dictionary(
                dictionary.get("processingInformation"))\
                if "processingInformation" in dictionary.keys()\
                else APIHelper.SKIP
        merchant_information =\
            MerchantInformation18.from_dictionary(
                dictionary.get("merchantInformation"))\
                if "merchantInformation" in dictionary.keys()\
                else APIHelper.SKIP
        instrument_identifier =\
            InstrumentIdentifier10.from_dictionary(
                dictionary.get("instrumentIdentifier"))\
                if "instrumentIdentifier" in dictionary.keys()\
                else APIHelper.SKIP
        metadata =\
            Metadata1.from_dictionary(
                dictionary.get("metadata"))\
                if "metadata" in dictionary.keys()\
                else APIHelper.SKIP
        embedded =\
            Embedded9.from_dictionary(
                dictionary.get("_embedded"))\
                if "_embedded" 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(links,
                   id,
                   object,
                   default,
                   state,
                   mtype,
                   bank_account,
                   card,
                   buyer_information,
                   bill_to,
                   processing_information,
                   merchant_information,
                   instrument_identifier,
                   metadata,
                   embedded,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _links=(
            self.links
            if hasattr(self, "links")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _object=(
            self.object
            if hasattr(self, "object")
            else None
        )
        _default=(
            self.default
            if hasattr(self, "default")
            else None
        )
        _state=(
            self.state
            if hasattr(self, "state")
            else None
        )
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _bank_account=(
            self.bank_account
            if hasattr(self, "bank_account")
            else None
        )
        _card=(
            self.card
            if hasattr(self, "card")
            else None
        )
        _buyer_information=(
            self.buyer_information
            if hasattr(self, "buyer_information")
            else None
        )
        _bill_to=(
            self.bill_to
            if hasattr(self, "bill_to")
            else None
        )
        _processing_information=(
            self.processing_information
            if hasattr(self, "processing_information")
            else None
        )
        _merchant_information=(
            self.merchant_information
            if hasattr(self, "merchant_information")
            else None
        )
        _instrument_identifier=(
            self.instrument_identifier
            if hasattr(self, "instrument_identifier")
            else None
        )
        _metadata=(
            self.metadata
            if hasattr(self, "metadata")
            else None
        )
        _embedded=(
            self.embedded
            if hasattr(self, "embedded")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"links={_links!r}, "
            f"id={_id!r}, "
            f"object={_object!r}, "
            f"default={_default!r}, "
            f"state={_state!r}, "
            f"mtype={_mtype!r}, "
            f"bank_account={_bank_account!r}, "
            f"card={_card!r}, "
            f"buyer_information={_buyer_information!r}, "
            f"bill_to={_bill_to!r}, "
            f"processing_information={_processing_information!r}, "
            f"merchant_information={_merchant_information!r}, "
            f"instrument_identifier={_instrument_identifier!r}, "
            f"metadata={_metadata!r}, "
            f"embedded={_embedded!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _links=(
            self.links
            if hasattr(self, "links")
            else None
        )
        _id=(
            self.id
            if hasattr(self, "id")
            else None
        )
        _object=(
            self.object
            if hasattr(self, "object")
            else None
        )
        _default=(
            self.default
            if hasattr(self, "default")
            else None
        )
        _state=(
            self.state
            if hasattr(self, "state")
            else None
        )
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _bank_account=(
            self.bank_account
            if hasattr(self, "bank_account")
            else None
        )
        _card=(
            self.card
            if hasattr(self, "card")
            else None
        )
        _buyer_information=(
            self.buyer_information
            if hasattr(self, "buyer_information")
            else None
        )
        _bill_to=(
            self.bill_to
            if hasattr(self, "bill_to")
            else None
        )
        _processing_information=(
            self.processing_information
            if hasattr(self, "processing_information")
            else None
        )
        _merchant_information=(
            self.merchant_information
            if hasattr(self, "merchant_information")
            else None
        )
        _instrument_identifier=(
            self.instrument_identifier
            if hasattr(self, "instrument_identifier")
            else None
        )
        _metadata=(
            self.metadata
            if hasattr(self, "metadata")
            else None
        )
        _embedded=(
            self.embedded
            if hasattr(self, "embedded")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"links={_links!s}, "
            f"id={_id!s}, "
            f"object={_object!s}, "
            f"default={_default!s}, "
            f"state={_state!s}, "
            f"mtype={_mtype!s}, "
            f"bank_account={_bank_account!s}, "
            f"card={_card!s}, "
            f"buyer_information={_buyer_information!s}, "
            f"bill_to={_bill_to!s}, "
            f"processing_information={_processing_information!s}, "
            f"merchant_information={_merchant_information!s}, "
            f"instrument_identifier={_instrument_identifier!s}, "
            f"metadata={_metadata!s}, "
            f"embedded={_embedded!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
