"""paypalserversdk.

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

# ruff: noqa: E501

class CaptureStatus(object):
    """Implementation of the 'Capture Status' enum.

    The status of the captured payment.

    Attributes:
        COMPLETED: The funds for this captured payment were credited to the payee's
            PayPal account.
        DECLINED: The funds could not be captured.
        PARTIALLY_REFUNDED: An amount less than this captured payment's amount was
            partially refunded to the payer.
        PENDING: The funds for this captured payment was not yet credited to the
            payee's PayPal account. For more information, see status.details.
        REFUNDED: An amount greater than or equal to this captured payment's amount
            was refunded to the payer.
        FAILED: There was an error while capturing payment.

    """

    COMPLETED = "COMPLETED"

    DECLINED = "DECLINED"

    PARTIALLY_REFUNDED = "PARTIALLY_REFUNDED"

    PENDING = "PENDING"

    REFUNDED = "REFUNDED"

    FAILED = "FAILED"

    @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
