"""paypalserversdk.

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

# ruff: noqa: E501

class ExperienceContextShippingPreference(object):
    """Implementation of the 'Experience Context Shipping Preference' enum.

    The location from which the shipping address is derived., The shipping
    preference. This only applies to PayPal payment source., The shipping preference.
    This only applies to PayPal payment source., The location from which the shipping
    address is derived.

    Attributes:
        GET_FROM_FILE: Get the customer-provided shipping address on the PayPal site.
        NO_SHIPPING: Redacts the shipping address from the PayPal site. Recommended
            for digital goods.
        SET_PROVIDED_ADDRESS: Merchant sends the shipping address using
            purchase_units.shipping.address. The customer cannot change this address
            on the PayPal site.

    """

    GET_FROM_FILE = "GET_FROM_FILE"

    NO_SHIPPING = "NO_SHIPPING"

    SET_PROVIDED_ADDRESS = "SET_PROVIDED_ADDRESS"

    @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
