"""paypalserversdk.

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

# ruff: noqa: E501

class FulfillmentType(object):
    """Implementation of the 'Fulfillment Type' enum.

    A classification for the method of purchase fulfillment (e.g shipping, in-store
    pickup, etc). Either `type` or `options` may be present, but not both.

    Attributes:
        SHIPPING: The payer intends to receive the items at a specified address.
        PICKUP_IN_PERSON: DEPRECATED. Please use "PICKUP_FROM_PERSON" instead.
        PICKUP_IN_STORE: The payer intends to pick up the item(s) from the payee's
            physical store. Also termed as BOPIS, "Buy Online, Pick-up in Store".
            Seller protection is provided with this option.
        PICKUP_FROM_PERSON: The payer intends to pick up the item(s) from the payee
            in person. Also termed as BOPIP, "Buy Online, Pick-up in Person". Seller
            protection is not available, since the payer is receiving the item from
            the payee in person, and can validate the item prior to payment.

    """

    SHIPPING = "SHIPPING"

    PICKUP_IN_PERSON = "PICKUP_IN_PERSON"

    PICKUP_IN_STORE = "PICKUP_IN_STORE"

    PICKUP_FROM_PERSON = "PICKUP_FROM_PERSON"

    @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
