"""cellpointapi.

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

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


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

    Wallet tokenized card.

    Attributes:
        token (str): Card token identifier. Used for both cards and Apple Pay.
        expires_at (datetime): When wallet token will expire.  TBD
        display_name (str): Display Payment Card Name.  A string, suitable for
            display, that describes the card.  For debit and credit cards, the
            display name often includes the card brand and the last four digits of
            the credit card number when available, for example: “************0492”,
            “Visa 1233”, “MasterCard 5678”, “AmEx 9876”. For Apple Pay Cash cards,
            the display name is “Apple Pay Cash”. However, there is no guarantee
            about the display name’s content or format.  To protect the user’s
            privacy, Apple Pay sets the display name only after the user authorizes
            the purchase.
        order_id (str): The model property of type str.
        scheme (CardScheme): The model property of type CardScheme.
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "token": "token",
        "expires_at": "expiresAt",
        "display_name": "displayName",
        "order_id": "orderId",
        "scheme": "scheme",
    }

    _optionals = [
        "expires_at",
        "display_name",
        "order_id",
        "scheme",
    ]

    def __init__(
        self,
        token=None,
        expires_at=APIHelper.SKIP,
        display_name=APIHelper.SKIP,
        order_id=APIHelper.SKIP,
        scheme=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a WalletTokenizedToken instance."""
        # Initialize members of the class
        self.token = token
        if expires_at is not APIHelper.SKIP:
            self.expires_at =\
                 APIHelper.apply_datetime_converter(
                expires_at, APIHelper.RFC3339DateTime)\
                 if expires_at else None
        if display_name is not APIHelper.SKIP:
            self.display_name = display_name
        if order_id is not APIHelper.SKIP:
            self.order_id = order_id
        if scheme is not APIHelper.SKIP:
            self.scheme = scheme

        # 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
        token =\
            dictionary.get("token")\
            if dictionary.get("token")\
                else None
        expires_at = APIHelper.RFC3339DateTime.from_value(
            dictionary.get("expiresAt")).datetime\
            if dictionary.get("expiresAt") else APIHelper.SKIP
        display_name =\
            dictionary.get("displayName")\
            if dictionary.get("displayName")\
                else APIHelper.SKIP
        order_id =\
            dictionary.get("orderId")\
            if dictionary.get("orderId")\
                else APIHelper.SKIP
        scheme =\
            dictionary.get("scheme")\
            if dictionary.get("scheme")\
                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(token,
                   expires_at,
                   display_name,
                   order_id,
                   scheme,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _token=self.token
        _expires_at=(
            self.expires_at
            if hasattr(self, "expires_at")
            else None
        )
        _display_name=(
            self.display_name
            if hasattr(self, "display_name")
            else None
        )
        _order_id=(
            self.order_id
            if hasattr(self, "order_id")
            else None
        )
        _scheme=(
            self.scheme
            if hasattr(self, "scheme")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"token={_token!r}, "
            f"expires_at={_expires_at!r}, "
            f"display_name={_display_name!r}, "
            f"order_id={_order_id!r}, "
            f"scheme={_scheme!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _token=self.token
        _expires_at=(
            self.expires_at
            if hasattr(self, "expires_at")
            else None
        )
        _display_name=(
            self.display_name
            if hasattr(self, "display_name")
            else None
        )
        _order_id=(
            self.order_id
            if hasattr(self, "order_id")
            else None
        )
        _scheme=(
            self.scheme
            if hasattr(self, "scheme")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"token={_token!s}, "
            f"expires_at={_expires_at!s}, "
            f"display_name={_display_name!s}, "
            f"order_id={_order_id!s}, "
            f"scheme={_scheme!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
