"""paypalserversdk.

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

# ruff: noqa: E501

class VaultUserAction(object):
    """Implementation of the 'Vault User Action' enum.

    User Action on action to be performed after a successful payer approval.

    Attributes:
        SETUP_NOW: After you redirect the customer to the PayPal payment page, a
            Setup Now button appears. Use this option when no additional inputs are
            needed from merchant site and to create the billing agreement immediately
            when the customer clicks Setup Now.
        CONTINUE: After you redirect the customer to the PayPal payment page, a
            Continue button appears. Use this option when you want to redirect the
            customer from the completed payment page to the merchant site for
            additional inputs without immediately creating the billing agreement.

    """

    SETUP_NOW = "SETUP_NOW"

    CONTINUE = "CONTINUE"

    @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
