"""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.address import Address
from paypalserversdk.models.name import Name
from paypalserversdk.models.phone_number import (
    PhoneNumber,
)
from paypalserversdk.models.venmo_wallet_attributes_response import (
    VenmoWalletAttributesResponse,
)


class VenmoWalletResponse(object):
    """Implementation of the 'Venmo Wallet Response' model.

    Venmo wallet response.

    Attributes:
        email_address (str): The internationalized email address. Note: Up to 64
            characters are allowed before and 255 characters are allowed after the @
            sign. However, the generally accepted maximum length for an email address
            is 254 characters. The pattern verifies that an unquoted @ sign exists.
        account_id (str): The PayPal payer ID, which is a masked version of the
            PayPal account number intended for use with third parties. The account
            number is reversibly encrypted and a proprietary variant of Base32 is
            used to encode the result.
        user_name (str): The Venmo user name chosen by the user, also know as a Venmo
            handle.
        name (Name): The name of the party.
        phone_number (PhoneNumber): The phone number in its canonical international
            [E.164 numbering plan format](https://www.itu.int/rec/T-REC-E.164/en).
        address (Address): The portable international postal address. Maps to
            [AddressValidationMetadata](https://github.com/googlei18n/libaddressinput/
            wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form controls:
            the autocomplete
            attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-co
            ntrols-the-autocomplete-attribute).
        return_flow (ReturnFlow): Merchant preference on how the buyer can navigate
            back to merchant website post approving the transaction on the Venmo App.
        attributes (VenmoWalletAttributesResponse): Additional attributes associated
            with the use of a Venmo Wallet.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "email_address": "email_address",
        "account_id": "account_id",
        "user_name": "user_name",
        "name": "name",
        "phone_number": "phone_number",
        "address": "address",
        "return_flow": "return_flow",
        "attributes": "attributes",
    }

    _optionals = [
        "email_address",
        "account_id",
        "user_name",
        "name",
        "phone_number",
        "address",
        "return_flow",
        "attributes",
    ]

    def __init__(
        self,
        email_address=APIHelper.SKIP,
        account_id=APIHelper.SKIP,
        user_name=APIHelper.SKIP,
        name=APIHelper.SKIP,
        phone_number=APIHelper.SKIP,
        address=APIHelper.SKIP,
        return_flow="AUTO",
        attributes=APIHelper.SKIP):
        """Initialize a VenmoWalletResponse instance."""
        # Initialize members of the class
        if email_address is not APIHelper.SKIP:
            self.email_address = email_address
        if account_id is not APIHelper.SKIP:
            self.account_id = account_id
        if user_name is not APIHelper.SKIP:
            self.user_name = user_name
        if name is not APIHelper.SKIP:
            self.name = name
        if phone_number is not APIHelper.SKIP:
            self.phone_number = phone_number
        if address is not APIHelper.SKIP:
            self.address = address
        self.return_flow = return_flow
        if attributes is not APIHelper.SKIP:
            self.attributes = attributes

    @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
        email_address =\
            dictionary.get("email_address")\
            if dictionary.get("email_address")\
                else APIHelper.SKIP
        account_id =\
            dictionary.get("account_id")\
            if dictionary.get("account_id")\
                else APIHelper.SKIP
        user_name =\
            dictionary.get("user_name")\
            if dictionary.get("user_name")\
                else APIHelper.SKIP
        name =\
            Name.from_dictionary(
                dictionary.get("name"))\
                if "name" in dictionary.keys()\
                else APIHelper.SKIP
        phone_number =\
            PhoneNumber.from_dictionary(
                dictionary.get("phone_number"))\
                if "phone_number" in dictionary.keys()\
                else APIHelper.SKIP
        address =\
            Address.from_dictionary(
                dictionary.get("address"))\
                if "address" in dictionary.keys()\
                else APIHelper.SKIP
        return_flow =\
            dictionary.get("return_flow")\
            if dictionary.get("return_flow")\
                else "AUTO"
        attributes =\
            VenmoWalletAttributesResponse.from_dictionary(
                dictionary.get("attributes"))\
                if "attributes" in dictionary.keys()\
                else APIHelper.SKIP

        # Return an object of this model
        return cls(email_address,
                   account_id,
                   user_name,
                   name,
                   phone_number,
                   address,
                   return_flow,
                   attributes)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _email_address=(
            self.email_address
            if hasattr(self, "email_address")
            else None
        )
        _account_id=(
            self.account_id
            if hasattr(self, "account_id")
            else None
        )
        _user_name=(
            self.user_name
            if hasattr(self, "user_name")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _phone_number=(
            self.phone_number
            if hasattr(self, "phone_number")
            else None
        )
        _address=(
            self.address
            if hasattr(self, "address")
            else None
        )
        _return_flow=(
            self.return_flow
            if hasattr(self, "return_flow")
            else None
        )
        _attributes=(
            self.attributes
            if hasattr(self, "attributes")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"email_address={_email_address!r}, "
            f"account_id={_account_id!r}, "
            f"user_name={_user_name!r}, "
            f"name={_name!r}, "
            f"phone_number={_phone_number!r}, "
            f"address={_address!r}, "
            f"return_flow={_return_flow!r}, "
            f"attributes={_attributes!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _email_address=(
            self.email_address
            if hasattr(self, "email_address")
            else None
        )
        _account_id=(
            self.account_id
            if hasattr(self, "account_id")
            else None
        )
        _user_name=(
            self.user_name
            if hasattr(self, "user_name")
            else None
        )
        _name=(
            self.name
            if hasattr(self, "name")
            else None
        )
        _phone_number=(
            self.phone_number
            if hasattr(self, "phone_number")
            else None
        )
        _address=(
            self.address
            if hasattr(self, "address")
            else None
        )
        _return_flow=(
            self.return_flow
            if hasattr(self, "return_flow")
            else None
        )
        _attributes=(
            self.attributes
            if hasattr(self, "attributes")
            else None
        )
        return (
            f"{self.__class__.__name__}("
            f"email_address={_email_address!s}, "
            f"account_id={_account_id!s}, "
            f"user_name={_user_name!s}, "
            f"name={_name!s}, "
            f"phone_number={_phone_number!s}, "
            f"address={_address!s}, "
            f"return_flow={_return_flow!s}, "
            f"attributes={_attributes!s}, "
            f")"
        )
