"""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.buyer_information_12 import (
    BuyerInformation12,
)
from visaacceptancemergedspec.models.client_reference_information_42 import (
    ClientReferenceInformation42,
)
from visaacceptancemergedspec.models.default_payment_instrument import (
    DefaultPaymentInstrument,
)
from visaacceptancemergedspec.models.default_shipping_address import (
    DefaultShippingAddress,
)
from visaacceptancemergedspec.models.embedded_4 import (
    Embedded4,
)
from visaacceptancemergedspec.models.links_19 import (
    Links19,
)
from visaacceptancemergedspec.models.merchant_defined_information_7 import (
    MerchantDefinedInformation7,
)
from visaacceptancemergedspec.models.metadata import (
    Metadata,
)
from visaacceptancemergedspec.models.object_information import (
    ObjectInformation,
)


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

    Attributes:
        links (Links19): The model property of type Links19.
        id (str): The Id of the Customer Token.
        object_information (ObjectInformation): The model property of type
            ObjectInformation.
        buyer_information (BuyerInformation12): The model property of type
            BuyerInformation12.
        client_reference_information (ClientReferenceInformation42): The model
            property of type ClientReferenceInformation42.
        merchant_defined_information (List[MerchantDefinedInformation7]): Object
            containing the custom data that the merchant defines.
        default_payment_instrument (DefaultPaymentInstrument): The model property of
            type DefaultPaymentInstrument.
        default_shipping_address (DefaultShippingAddress): The model property of type
            DefaultShippingAddress.
        metadata (Metadata): The model property of type Metadata.
        embedded (Embedded4): The model property of type Embedded4.
        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_information": "objectInformation",
        "buyer_information": "buyerInformation",
        "client_reference_information": "clientReferenceInformation",
        "merchant_defined_information": "merchantDefinedInformation",
        "default_payment_instrument": "defaultPaymentInstrument",
        "default_shipping_address": "defaultShippingAddress",
        "metadata": "metadata",
        "embedded": "_embedded",
    }

    _optionals = [
        "links",
        "id",
        "object_information",
        "buyer_information",
        "client_reference_information",
        "merchant_defined_information",
        "default_payment_instrument",
        "default_shipping_address",
        "metadata",
        "embedded",
    ]

    def __init__(
        self,
        links=APIHelper.SKIP,
        id=APIHelper.SKIP,
        object_information=APIHelper.SKIP,
        buyer_information=APIHelper.SKIP,
        client_reference_information=APIHelper.SKIP,
        merchant_defined_information=APIHelper.SKIP,
        default_payment_instrument=APIHelper.SKIP,
        default_shipping_address=APIHelper.SKIP,
        metadata=APIHelper.SKIP,
        embedded=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a PatchCustomerRequest 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_information is not APIHelper.SKIP:
            self.object_information = object_information
        if buyer_information is not APIHelper.SKIP:
            self.buyer_information = buyer_information
        if client_reference_information is not APIHelper.SKIP:
            self.client_reference_information = client_reference_information
        if merchant_defined_information is not APIHelper.SKIP:
            self.merchant_defined_information = merchant_defined_information
        if default_payment_instrument is not APIHelper.SKIP:
            self.default_payment_instrument = default_payment_instrument
        if default_shipping_address is not APIHelper.SKIP:
            self.default_shipping_address = default_shipping_address
        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 =\
            Links19.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_information =\
            ObjectInformation.from_dictionary(
                dictionary.get("objectInformation"))\
                if "objectInformation" in dictionary.keys()\
                else APIHelper.SKIP
        buyer_information =\
            BuyerInformation12.from_dictionary(
                dictionary.get("buyerInformation"))\
                if "buyerInformation" in dictionary.keys()\
                else APIHelper.SKIP
        client_reference_information =\
            ClientReferenceInformation42.from_dictionary(
                dictionary.get("clientReferenceInformation"))\
                if "clientReferenceInformation" in dictionary.keys()\
                else APIHelper.SKIP
        merchant_defined_information = None
        if dictionary.get("merchantDefinedInformation") is not None:
            merchant_defined_information = [
                MerchantDefinedInformation7.from_dictionary(x)
                    for x in dictionary.get("merchantDefinedInformation")
            ]
        else:
            merchant_defined_information = APIHelper.SKIP
        default_payment_instrument =\
            DefaultPaymentInstrument.from_dictionary(
                dictionary.get("defaultPaymentInstrument"))\
                if "defaultPaymentInstrument" in dictionary.keys()\
                else APIHelper.SKIP
        default_shipping_address =\
            DefaultShippingAddress.from_dictionary(
                dictionary.get("defaultShippingAddress"))\
                if "defaultShippingAddress" in dictionary.keys()\
                else APIHelper.SKIP
        metadata =\
            Metadata.from_dictionary(
                dictionary.get("metadata"))\
                if "metadata" in dictionary.keys()\
                else APIHelper.SKIP
        embedded =\
            Embedded4.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_information,
                   buyer_information,
                   client_reference_information,
                   merchant_defined_information,
                   default_payment_instrument,
                   default_shipping_address,
                   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_information=(
            self.object_information
            if hasattr(self, "object_information")
            else None
        )
        _buyer_information=(
            self.buyer_information
            if hasattr(self, "buyer_information")
            else None
        )
        _client_reference_information=(
            self.client_reference_information
            if hasattr(self, "client_reference_information")
            else None
        )
        _merchant_defined_information=(
            self.merchant_defined_information
            if hasattr(self, "merchant_defined_information")
            else None
        )
        _default_payment_instrument=(
            self.default_payment_instrument
            if hasattr(self, "default_payment_instrument")
            else None
        )
        _default_shipping_address=(
            self.default_shipping_address
            if hasattr(self, "default_shipping_address")
            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_information={_object_information!r}, "
            f"buyer_information={_buyer_information!r}, "
            f"client_reference_information={_client_reference_information!r}, "
            f"merchant_defined_information={_merchant_defined_information!r}, "
            f"default_payment_instrument={_default_payment_instrument!r}, "
            f"default_shipping_address={_default_shipping_address!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_information=(
            self.object_information
            if hasattr(self, "object_information")
            else None
        )
        _buyer_information=(
            self.buyer_information
            if hasattr(self, "buyer_information")
            else None
        )
        _client_reference_information=(
            self.client_reference_information
            if hasattr(self, "client_reference_information")
            else None
        )
        _merchant_defined_information=(
            self.merchant_defined_information
            if hasattr(self, "merchant_defined_information")
            else None
        )
        _default_payment_instrument=(
            self.default_payment_instrument
            if hasattr(self, "default_payment_instrument")
            else None
        )
        _default_shipping_address=(
            self.default_shipping_address
            if hasattr(self, "default_shipping_address")
            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_information={_object_information!s}, "
            f"buyer_information={_buyer_information!s}, "
            f"client_reference_information={_client_reference_information!s}, "
            f"merchant_defined_information={_merchant_defined_information!s}, "
            f"default_payment_instrument={_default_payment_instrument!s}, "
            f"default_shipping_address={_default_shipping_address!s}, "
            f"metadata={_metadata!s}, "
            f"embedded={_embedded!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
