"""cellpointapi.

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

# ruff: noqa: E501
from cellpointapi.api_helper import APIHelper
from cellpointapi.models.pk_payment_token import (
    PkPaymentToken,
)


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

    Wrapper object for saving Apple pay token request

    Attributes:
        merchant_id (str): Merchant ID assigned by CellPoint Digital
        pk_payment_token (PkPaymentToken): Encrypted Apple Pay token with metadata.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "merchant_id": "merchantId",
        "pk_payment_token": "pkPaymentToken",
    }

    def __init__(
        self,
        merchant_id=None,
        pk_payment_token=None,
        additional_properties=None):
        """Initialize a SavePkPaymentTokenRequest instance."""
        # Initialize members of the class
        self.merchant_id = merchant_id
        self.pk_payment_token = pk_payment_token

        # 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
        merchant_id =\
            dictionary.get("merchantId")\
            if dictionary.get("merchantId")\
                else None
        pk_payment_token =\
            PkPaymentToken.from_dictionary(
                dictionary.get("pkPaymentToken"))\
                if dictionary.get("pkPaymentToken") 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(merchant_id,
                   pk_payment_token,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _merchant_id=self.merchant_id
        _pk_payment_token=self.pk_payment_token
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"merchant_id={_merchant_id!r}, "
            f"pk_payment_token={_pk_payment_token!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _merchant_id=self.merchant_id
        _pk_payment_token=self.pk_payment_token
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"merchant_id={_merchant_id!s}, "
            f"pk_payment_token={_pk_payment_token!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
