"""paypalserversdk.

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

# ruff: noqa: E501

class AuthorizationStatus(object):
    """Implementation of the 'Authorization Status' enum.

    The status for the authorized payment.

    Attributes:
        CREATED: The authorized payment is created. No captured payments have been
            made for this authorized payment.
        CAPTURED: The authorized payment has one or more captures against it. The sum
            of these captured payments is greater than the amount of the original
            authorized payment.
        DENIED: PayPal cannot authorize funds for this authorized payment.
        PARTIALLY_CAPTURED: A captured payment was made for the authorized payment
            for an amount that is less than the amount of the original authorized
            payment.
        VOIDED: The authorized payment was voided. No more captured payments can be
            made against this authorized payment.
        PENDING: The created authorization is in pending state. For more information,
            see status.details.

    """

    CREATED = "CREATED"

    CAPTURED = "CAPTURED"

    DENIED = "DENIED"

    PARTIALLY_CAPTURED = "PARTIALLY_CAPTURED"

    VOIDED = "VOIDED"

    PENDING = "PENDING"

    @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
