"""paypalserversdk.

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

# ruff: noqa: E501

class CheckoutPaymentIntent(object):
    """Implementation of the 'Checkout Payment Intent' enum.

    The intent to either capture payment immediately or authorize a payment for an
    order after order creation.

    Attributes:
        CAPTURE: The merchant intends to capture payment immediately after the
            customer makes a payment.
        AUTHORIZE: The merchant intends to authorize a payment and place funds on
            hold after the customer makes a payment. Authorized payments are best
            captured within three days of authorization but are available to capture
            for up to 29 days. After the three-day honor period, the original
            authorized payment expires and you must re-authorize the payment. You
            must make a separate request to capture payments on demand. This intent
            is not supported when you have more than one `purchase_unit` within your
            order.

    """

    CAPTURE = "CAPTURE"

    AUTHORIZE = "AUTHORIZE"

    @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
