"""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.callback_configuration import (
    CallbackConfiguration,
)


class VenmoWalletExperienceContext(object):
    """Implementation of the 'Venmo Wallet Experience Context' model.

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

    Attributes:
        brand_name (str): The business name of the merchant. The pattern is defined
            by an external party and supports Unicode.
        shipping_preference (VenmoWalletExperienceContextShippingPreference): The
            location from which the shipping address is derived.
        order_update_callback_config (CallbackConfiguration): CallBack Configuration
            that the merchant can provide to PayPal/Venmo.
        user_action (VenmoWalletExperienceContextUserAction): Configures a Continue
            or Pay Now checkout flow.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "brand_name": "brand_name",
        "shipping_preference": "shipping_preference",
        "order_update_callback_config": "order_update_callback_config",
        "user_action": "user_action",
    }

    _optionals = [
        "brand_name",
        "shipping_preference",
        "order_update_callback_config",
        "user_action",
    ]

    def __init__(
        self,
        brand_name=APIHelper.SKIP,
        shipping_preference="GET_FROM_FILE",
        order_update_callback_config=APIHelper.SKIP,
        user_action="CONTINUE"):
        """Initialize a VenmoWalletExperienceContext instance."""
        # Initialize members of the class
        if brand_name is not APIHelper.SKIP:
            self.brand_name = brand_name
        self.shipping_preference = shipping_preference
        if order_update_callback_config is not APIHelper.SKIP:
            self.order_update_callback_config = order_update_callback_config
        self.user_action = user_action

    @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
        shipping_preference =\
            dictionary.get("shipping_preference")\
            if dictionary.get("shipping_preference")\
                else "GET_FROM_FILE"
        order_update_callback_config =\
            CallbackConfiguration.from_dictionary(
                dictionary.get("order_update_callback_config"))\
                if "order_update_callback_config" in dictionary.keys()\
                else APIHelper.SKIP
        user_action =\
            dictionary.get("user_action")\
            if dictionary.get("user_action")\
                else "CONTINUE"

        # Return an object of this model
        return cls(brand_name,
                   shipping_preference,
                   order_update_callback_config,
                   user_action)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _brand_name=(
            self.brand_name
            if hasattr(self, "brand_name")
            else None
        )
        _shipping_preference=(
            self.shipping_preference
            if hasattr(self, "shipping_preference")
            else None
        )
        _order_update_callback_config=(
            self.order_update_callback_config
            if hasattr(self, "order_update_callback_config")
            else None
        )
        _user_action=(
            self.user_action
            if hasattr(self, "user_action")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"brand_name={_brand_name!r}, "
            f"shipping_preference={_shipping_preference!r}, "
            f"order_update_callback_config={_order_update_callback_config!r}, "
            f"user_action={_user_action!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _brand_name=(
            self.brand_name
            if hasattr(self, "brand_name")
            else None
        )
        _shipping_preference=(
            self.shipping_preference
            if hasattr(self, "shipping_preference")
            else None
        )
        _order_update_callback_config=(
            self.order_update_callback_config
            if hasattr(self, "order_update_callback_config")
            else None
        )
        _user_action=(
            self.user_action
            if hasattr(self, "user_action")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"brand_name={_brand_name!s}, "
            f"shipping_preference={_shipping_preference!s}, "
            f"order_update_callback_config={_order_update_callback_config!s}, "
            f"user_action={_user_action!s}, "
            f")"
        )
