"""paypalserversdk.

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

# ruff: noqa: E501
from paypalserversdk.api_helper import APIHelper
from paypalserversdk.models.app_switch_context import (
    AppSwitchContext,
)
from paypalserversdk.models.callback_configuration import (
    CallbackConfiguration,
)


class PaypalWalletExperienceContext(object):
    """Implementation of the 'PayPal Wallet Experience Context' model.

    Customizes the payer experience during the approval process for payment with
    PayPal. Note: Partners and Marketplaces might configure brand_name and
    shipping_preference during partner account setup, which overrides the request
    values.

    Attributes:
        brand_name (str): The label that overrides the business name in the PayPal
            account on the PayPal site. The pattern is defined by an external party
            and supports Unicode.
        locale (str): The [language tag](https://tools.ietf.org/html/bcp47#section-2)
            for the language in which to localize the error-related strings, such as
            messages, issues, and suggested actions. The tag is made up of the [ISO
            639-2 language
            code](https://www.loc.gov/standards/iso639-2/php/code_list.php), the
            optional [ISO-15924 script
            tag](https://www.unicode.org/iso15924/codelists.html), and the [ISO-3166
            alpha-2 country code](/api/rest/reference/country-codes/) or [M49 region
            code](https://unstats.un.org/unsd/methodology/m49/).
        shipping_preference (PaypalWalletContextShippingPreference): The location
            from which the shipping address is derived.
        contact_preference (PaypalWalletContactPreference): The preference to display
            the contact information (buyer’s shipping email & phone number) on
            PayPal's checkout for easy merchant-buyer communication.
        return_url (str): Describes the URL.
        cancel_url (str): Describes the URL.
        app_switch_context (AppSwitchContext): Merchant provided details of the
            native app or mobile web browser to facilitate buyer's app switch to the
            PayPal consumer app.
        landing_page (PaypalExperienceLandingPage): The type of landing page to show
            on the PayPal site for customer checkout.
        user_action (PaypalExperienceUserAction): Configures a Continue or Pay Now
            checkout flow.
        payment_method_preference (PayeePaymentMethodPreference): The
            merchant-preferred payment methods.
        order_update_callback_config (CallbackConfiguration): CallBack Configuration
            that the merchant can provide to PayPal/Venmo.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "brand_name": "brand_name",
        "locale": "locale",
        "shipping_preference": "shipping_preference",
        "contact_preference": "contact_preference",
        "return_url": "return_url",
        "cancel_url": "cancel_url",
        "app_switch_context": "app_switch_context",
        "landing_page": "landing_page",
        "user_action": "user_action",
        "payment_method_preference": "payment_method_preference",
        "order_update_callback_config": "order_update_callback_config",
    }

    _optionals = [
        "brand_name",
        "locale",
        "shipping_preference",
        "contact_preference",
        "return_url",
        "cancel_url",
        "app_switch_context",
        "landing_page",
        "user_action",
        "payment_method_preference",
        "order_update_callback_config",
    ]

    def __init__(
        self,
        brand_name=APIHelper.SKIP,
        locale=APIHelper.SKIP,
        shipping_preference="GET_FROM_FILE",
        contact_preference="NO_CONTACT_INFO",
        return_url=APIHelper.SKIP,
        cancel_url=APIHelper.SKIP,
        app_switch_context=APIHelper.SKIP,
        landing_page="NO_PREFERENCE",
        user_action="CONTINUE",
        payment_method_preference="UNRESTRICTED",
        order_update_callback_config=APIHelper.SKIP):
        """Initialize a PaypalWalletExperienceContext instance."""
        # Initialize members of the class
        if brand_name is not APIHelper.SKIP:
            self.brand_name = brand_name
        if locale is not APIHelper.SKIP:
            self.locale = locale
        self.shipping_preference = shipping_preference
        self.contact_preference = contact_preference
        if return_url is not APIHelper.SKIP:
            self.return_url = return_url
        if cancel_url is not APIHelper.SKIP:
            self.cancel_url = cancel_url
        if app_switch_context is not APIHelper.SKIP:
            self.app_switch_context = app_switch_context
        self.landing_page = landing_page
        self.user_action = user_action
        self.payment_method_preference = payment_method_preference
        if order_update_callback_config is not APIHelper.SKIP:
            self.order_update_callback_config = order_update_callback_config

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        brand_name =\
            dictionary.get("brand_name")\
            if dictionary.get("brand_name")\
                else APIHelper.SKIP
        locale =\
            dictionary.get("locale")\
            if dictionary.get("locale")\
                else APIHelper.SKIP
        shipping_preference =\
            dictionary.get("shipping_preference")\
            if dictionary.get("shipping_preference")\
                else "GET_FROM_FILE"
        contact_preference =\
            dictionary.get("contact_preference")\
            if dictionary.get("contact_preference")\
                else "NO_CONTACT_INFO"
        return_url =\
            dictionary.get("return_url")\
            if dictionary.get("return_url")\
                else APIHelper.SKIP
        cancel_url =\
            dictionary.get("cancel_url")\
            if dictionary.get("cancel_url")\
                else APIHelper.SKIP
        app_switch_context =\
            AppSwitchContext.from_dictionary(
                dictionary.get("app_switch_context"))\
                if "app_switch_context" in dictionary.keys()\
                else APIHelper.SKIP
        landing_page =\
            dictionary.get("landing_page")\
            if dictionary.get("landing_page")\
                else "NO_PREFERENCE"
        user_action =\
            dictionary.get("user_action")\
            if dictionary.get("user_action")\
                else "CONTINUE"
        payment_method_preference =\
            dictionary.get("payment_method_preference")\
            if dictionary.get("payment_method_preference")\
                else "UNRESTRICTED"
        order_update_callback_config =\
            CallbackConfiguration.from_dictionary(
                dictionary.get("order_update_callback_config"))\
                if "order_update_callback_config" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(brand_name,
                   locale,
                   shipping_preference,
                   contact_preference,
                   return_url,
                   cancel_url,
                   app_switch_context,
                   landing_page,
                   user_action,
                   payment_method_preference,
                   order_update_callback_config)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _brand_name=(
            self.brand_name
            if hasattr(self, "brand_name")
            else None
        )
        _locale=(
            self.locale
            if hasattr(self, "locale")
            else None
        )
        _shipping_preference=(
            self.shipping_preference
            if hasattr(self, "shipping_preference")
            else None
        )
        _contact_preference=(
            self.contact_preference
            if hasattr(self, "contact_preference")
            else None
        )
        _return_url=(
            self.return_url
            if hasattr(self, "return_url")
            else None
        )
        _cancel_url=(
            self.cancel_url
            if hasattr(self, "cancel_url")
            else None
        )
        _app_switch_context=(
            self.app_switch_context
            if hasattr(self, "app_switch_context")
            else None
        )
        _landing_page=(
            self.landing_page
            if hasattr(self, "landing_page")
            else None
        )
        _user_action=(
            self.user_action
            if hasattr(self, "user_action")
            else None
        )
        _payment_method_preference=(
            self.payment_method_preference
            if hasattr(self, "payment_method_preference")
            else None
        )
        _order_update_callback_config=(
            self.order_update_callback_config
            if hasattr(self, "order_update_callback_config")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"brand_name={_brand_name!r}, "
            f"locale={_locale!r}, "
            f"shipping_preference={_shipping_preference!r}, "
            f"contact_preference={_contact_preference!r}, "
            f"return_url={_return_url!r}, "
            f"cancel_url={_cancel_url!r}, "
            f"app_switch_context={_app_switch_context!r}, "
            f"landing_page={_landing_page!r}, "
            f"user_action={_user_action!r}, "
            f"payment_method_preference={_payment_method_preference!r}, "
            f"order_update_callback_config={_order_update_callback_config!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _brand_name=(
            self.brand_name
            if hasattr(self, "brand_name")
            else None
        )
        _locale=(
            self.locale
            if hasattr(self, "locale")
            else None
        )
        _shipping_preference=(
            self.shipping_preference
            if hasattr(self, "shipping_preference")
            else None
        )
        _contact_preference=(
            self.contact_preference
            if hasattr(self, "contact_preference")
            else None
        )
        _return_url=(
            self.return_url
            if hasattr(self, "return_url")
            else None
        )
        _cancel_url=(
            self.cancel_url
            if hasattr(self, "cancel_url")
            else None
        )
        _app_switch_context=(
            self.app_switch_context
            if hasattr(self, "app_switch_context")
            else None
        )
        _landing_page=(
            self.landing_page
            if hasattr(self, "landing_page")
            else None
        )
        _user_action=(
            self.user_action
            if hasattr(self, "user_action")
            else None
        )
        _payment_method_preference=(
            self.payment_method_preference
            if hasattr(self, "payment_method_preference")
            else None
        )
        _order_update_callback_config=(
            self.order_update_callback_config
            if hasattr(self, "order_update_callback_config")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"brand_name={_brand_name!s}, "
            f"locale={_locale!s}, "
            f"shipping_preference={_shipping_preference!s}, "
            f"contact_preference={_contact_preference!s}, "
            f"return_url={_return_url!s}, "
            f"cancel_url={_cancel_url!s}, "
            f"app_switch_context={_app_switch_context!s}, "
            f"landing_page={_landing_page!s}, "
            f"user_action={_user_action!s}, "
            f"payment_method_preference={_payment_method_preference!s}, "
            f"order_update_callback_config={_order_update_callback_config!s}, "
            f")"
        )
