"""mindbodypublicapi.

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

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


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

    Contains information about any payment processing failure.  Specifically for when
    an SCA challenge is

    Attributes:
        mtype (str): Returned only if SCA challenge is indicated.
        message (str): Returned only if SCA challenge is indicated.
        authentication_redirect_url (str): Returned only if SCA challenge is
            indicated.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "mtype": "Type",
        "message": "Message",
        "authentication_redirect_url": "AuthenticationRedirectUrl",
    }

    _optionals = [
        "mtype",
        "message",
        "authentication_redirect_url",
    ]

    def __init__(
        self,
        mtype=APIHelper.SKIP,
        message=APIHelper.SKIP,
        authentication_redirect_url=APIHelper.SKIP):
        """Initialize a PaymentProcessingFailure instance."""
        # Initialize members of the class
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype
        if message is not APIHelper.SKIP:
            self.message = message
        if authentication_redirect_url is not APIHelper.SKIP:
            self.authentication_redirect_url = authentication_redirect_url

    @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
        mtype =\
            dictionary.get("Type")\
            if dictionary.get("Type")\
                else APIHelper.SKIP
        message =\
            dictionary.get("Message")\
            if dictionary.get("Message")\
                else APIHelper.SKIP
        authentication_redirect_url =\
            dictionary.get("AuthenticationRedirectUrl")\
            if dictionary.get("AuthenticationRedirectUrl")\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(mtype,
                   message,
                   authentication_redirect_url)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _message=(
            self.message
            if hasattr(self, "message")
            else None
        )
        _authentication_redirect_url=(
            self.authentication_redirect_url
            if hasattr(self, "authentication_redirect_url")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"mtype={_mtype!r}, "
            f"message={_message!r}, "
            f"authentication_redirect_url={_authentication_redirect_url!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _message=(
            self.message
            if hasattr(self, "message")
            else None
        )
        _authentication_redirect_url=(
            self.authentication_redirect_url
            if hasattr(self, "authentication_redirect_url")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"mtype={_mtype!s}, "
            f"message={_message!s}, "
            f"authentication_redirect_url={_authentication_redirect_url!s}, "
            f")"
        )
