"""paypalserversdk.

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

# ruff: noqa: E501

class LinkHttpMethod(object):
    """Implementation of the 'Link HTTP Method' enum.

    The HTTP method required to make the related call.

    Attributes:
        GET: The HTTP GET method.
        POST: The HTTP POST method.
        PUT: The HTTP PUT method.
        DELETE: The HTTP DELETE method.
        HEAD: The HTTP HEAD method.
        CONNECT: The HTTP CONNECT method.
        OPTIONS: The HTTP OPTIONS method.
        PATCH: The HTTP PATCH method.

    """

    GET = "GET"

    POST = "POST"

    PUT = "PUT"

    DELETE = "DELETE"

    HEAD = "HEAD"

    CONNECT = "CONNECT"

    OPTIONS = "OPTIONS"

    PATCH = "PATCH"

    @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
