"""paypalserversdk.

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

# ruff: noqa: E501

class PaResStatus(object):
    """Implementation of the 'PARes Status' enum.

    Transactions status result identifier. The outcome of the issuer's authentication.

    Attributes:
        SUCCESSFULAUTHENTICATION: Successful authentication.
        FAILEDAUTHENTICATION: Failed authentication / account not verified /
            transaction denied.
        UNABLETOCOMPLETEAUTHENTICATION: Unable to complete authentication.
        SUCCESSFULATTEMPTSTRANSACTION: Successful attempts transaction.
        CHALLENGEREQUIRED: Challenge required for authentication.
        AUTHENTICATIONREJECTED: Authentication rejected (merchant must not submit for
            authorization).
        DECOUPLEDAUTHENTICATION: Challenge required; decoupled authentication
            confirmed.
        INFORMATIONALONLY: Informational only; 3DS requestor challenge preference
            acknowledged.

    """

    SUCCESSFULAUTHENTICATION = "Y"

    FAILEDAUTHENTICATION = "N"

    UNABLETOCOMPLETEAUTHENTICATION = "U"

    SUCCESSFULATTEMPTSTRANSACTION = "A"

    CHALLENGEREQUIRED = "C"

    AUTHENTICATIONREJECTED = "R"

    DECOUPLEDAUTHENTICATION = "D"

    INFORMATIONALONLY = "I"

    @classmethod
    def from_value(cls, value, default=None):
        """Return the matching enum value for the given input."""
        if value is None:
            return default

        # If numeric and matches directly
        if isinstance(value, int):
            for name, val in cls.__dict__.items():
                if not name.startswith("_") and val == value:
                    return val

        # If string, perform case-insensitive match
        if isinstance(value, str):
            value_lower = value.lower()
            for name, val in cls.__dict__.items():
                if not name.startswith("_") and (
                    name.lower() == value_lower or str(val).lower() == value_lower
                ):
                    return val

        # Fallback to default
        return default
