"""cellpointapi.

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

# ruff: noqa: E501

class Type4(object):
    """Implementation of the 'Type4' enum.

    Attributes:
        CANCEL: The enum member of type str.
        CAPTURE: The enum member of type str.
        REFUND: The enum member of type str.
        CLOSE: The enum member of type str.
        RECONCILIATION: The enum member of type str.
        POST_AUTH_FRAUD_CHECK: The enum member of type str.
        REFUND_RETRY: The enum member of type str.

    """

    CANCEL = "CANCEL"

    CAPTURE = "CAPTURE"

    REFUND = "REFUND"

    CLOSE = "CLOSE"

    RECONCILIATION = "RECONCILIATION"

    POST_AUTH_FRAUD_CHECK = "POST_AUTH_FRAUD_CHECK"

    REFUND_RETRY = "REFUND_RETRY"

    @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
