"""paypalserversdk.

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

# ruff: noqa: E501

class PaymentTokenStatus(object):
    """Implementation of the 'Payment Token Status' enum.

    The status of the payment token.

    Attributes:
        CREATED: A setup token is initialized with minimal information, more data
            must be added to the setup-token to be vaulted
        PAYER_ACTION_REQUIRED: A contingency on payer approval is required before the
            payment method can be saved.
        APPROVED: Setup token is ready to be vaulted. If a buyer approval contigency
            was returned, it is has been approved.
        VAULTED: The payment token has been vaulted.
        TOKENIZED: A vaulted payment method token has been tokenized for short term
            (one time) use.

    """

    CREATED = "CREATED"

    PAYER_ACTION_REQUIRED = "PAYER_ACTION_REQUIRED"

    APPROVED = "APPROVED"

    VAULTED = "VAULTED"

    TOKENIZED = "TOKENIZED"

    @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
