"""paypalserversdk.

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

# ruff: noqa: E501
from paypalserversdk.api_helper import APIHelper


class ApplePayPaymentData(object):
    """Implementation of the 'Apple Pay Payment Data' model.

    Information about the decrypted apple pay payment data for the token like
    cryptogram, eci indicator.

    Attributes:
        cryptogram (str): Online payment cryptogram, as defined by 3D Secure. The
            pattern is defined by an external party and supports Unicode.
        eci_indicator (str): ECI indicator, as defined by 3- Secure. The pattern is
            defined by an external party and supports Unicode.
        emv_data (str): Encoded Apple Pay EMV Payment Structure used for payments in
            China. The pattern is defined by an external party and supports Unicode.
        pin (str): Bank Key encrypted Apple Pay PIN. The pattern is defined by an
            external party and supports Unicode.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "cryptogram": "cryptogram",
        "eci_indicator": "eci_indicator",
        "emv_data": "emv_data",
        "pin": "pin",
    }

    _optionals = [
        "cryptogram",
        "eci_indicator",
        "emv_data",
        "pin",
    ]

    def __init__(
        self,
        cryptogram=APIHelper.SKIP,
        eci_indicator=APIHelper.SKIP,
        emv_data=APIHelper.SKIP,
        pin=APIHelper.SKIP):
        """Initialize a ApplePayPaymentData instance."""
        # Initialize members of the class
        if cryptogram is not APIHelper.SKIP:
            self.cryptogram = cryptogram
        if eci_indicator is not APIHelper.SKIP:
            self.eci_indicator = eci_indicator
        if emv_data is not APIHelper.SKIP:
            self.emv_data = emv_data
        if pin is not APIHelper.SKIP:
            self.pin = pin

    @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
        cryptogram =\
            dictionary.get("cryptogram")\
            if dictionary.get("cryptogram")\
                else APIHelper.SKIP
        eci_indicator =\
            dictionary.get("eci_indicator")\
            if dictionary.get("eci_indicator")\
                else APIHelper.SKIP
        emv_data =\
            dictionary.get("emv_data")\
            if dictionary.get("emv_data")\
                else APIHelper.SKIP
        pin =\
            dictionary.get("pin")\
            if dictionary.get("pin")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(cryptogram,
                   eci_indicator,
                   emv_data,
                   pin)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _cryptogram=(
            self.cryptogram
            if hasattr(self, "cryptogram")
            else None
        )
        _eci_indicator=(
            self.eci_indicator
            if hasattr(self, "eci_indicator")
            else None
        )
        _emv_data=(
            self.emv_data
            if hasattr(self, "emv_data")
            else None
        )
        _pin=(
            self.pin
            if hasattr(self, "pin")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"cryptogram={_cryptogram!r}, "
            f"eci_indicator={_eci_indicator!r}, "
            f"emv_data={_emv_data!r}, "
            f"pin={_pin!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _cryptogram=(
            self.cryptogram
            if hasattr(self, "cryptogram")
            else None
        )
        _eci_indicator=(
            self.eci_indicator
            if hasattr(self, "eci_indicator")
            else None
        )
        _emv_data=(
            self.emv_data
            if hasattr(self, "emv_data")
            else None
        )
        _pin=(
            self.pin
            if hasattr(self, "pin")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"cryptogram={_cryptogram!s}, "
            f"eci_indicator={_eci_indicator!s}, "
            f"emv_data={_emv_data!s}, "
            f"pin={_pin!s}, "
            f")"
        )
