"""cellpointapi.

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

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


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

    Payment data header for EC token, RSA is not supported

    Attributes:
        public_key_hash (str): Hash of the X.509 encoded public key bytes of the
            merchant’s certificate.
        ephemeral_public_key (str): X.509 encoded key bytes, Base64 encoded as a
            string.
        transaction_id (str): Transaction identifier, generated on the client device.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "public_key_hash": "publicKeyHash",
        "ephemeral_public_key": "ephemeralPublicKey",
        "transaction_id": "transactionId",
    }

    def __init__(
        self,
        public_key_hash=None,
        ephemeral_public_key=None,
        transaction_id=None,
        additional_properties=None):
        """Initialize a PaymentDataHeader instance."""
        # Initialize members of the class
        self.public_key_hash = public_key_hash
        self.ephemeral_public_key = ephemeral_public_key
        self.transaction_id = transaction_id

        # 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
        public_key_hash =\
            dictionary.get("publicKeyHash")\
            if dictionary.get("publicKeyHash")\
                else None
        ephemeral_public_key =\
            dictionary.get("ephemeralPublicKey")\
            if dictionary.get("ephemeralPublicKey")\
                else None
        transaction_id =\
            dictionary.get("transactionId")\
            if dictionary.get("transactionId")\
                else None

        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(public_key_hash,
                   ephemeral_public_key,
                   transaction_id,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _public_key_hash=self.public_key_hash
        _ephemeral_public_key=self.ephemeral_public_key
        _transaction_id=self.transaction_id
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"public_key_hash={_public_key_hash!r}, "
            f"ephemeral_public_key={_ephemeral_public_key!r}, "
            f"transaction_id={_transaction_id!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _public_key_hash=self.public_key_hash
        _ephemeral_public_key=self.ephemeral_public_key
        _transaction_id=self.transaction_id
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"public_key_hash={_public_key_hash!s}, "
            f"ephemeral_public_key={_ephemeral_public_key!s}, "
            f"transaction_id={_transaction_id!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
