# -*- coding: utf-8 -*-

"""
paypalrestapis

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from paypalrestapis.api_helper import APIHelper
from paypalrestapis.models.address import Address
from paypalrestapis.models.name import Name
from paypalrestapis.models.phone_with_type import PhoneWithType
from paypalrestapis.models.vaulted_digital_wallet_shipping_details import VaultedDigitalWalletShippingDetails


class VenmoPaymentToken(object):

    """Implementation of the 'Venmo Payment Token' model.

    Attributes:
        description (str): The description displayed to the consumer on the
            approval flow for a digital wallet, as well as on the merchant
            view of the payment token management experience. exp: PayPal.com.
        shipping (VaultedDigitalWalletShippingDetails): The shipping details.
        permit_multiple_payment_tokens (bool): Create multiple payment tokens
            for the same payer, merchant/platform combination. Use this when
            the customer has not logged in at merchant/platform. The payment
            token thus generated, can then also be used to create the customer
            account at merchant/platform. Use this also when multiple payment
            tokens are required for the same payer, different customer at
            merchant/platform. This helps to identify customers distinctly
            even though they may share the same PayPal account. This only
            applies to PayPal payment source.
        usage_type (str): The usage type associated with a digital wallet
            payment token.
        customer_type (str): The customer type associated with a digital
            wallet payment token. This is to indicate whether the customer
            acting on the merchant / platform is either a business or a
            consumer.
        email_address (str): The internationalized email
            address.<blockquote><strong>Note:</strong> Up to 64 characters are
            allowed before and 255 characters are allowed after the
            <code>@</code> sign. However, the generally accepted maximum
            length for an email address is 254 characters. The pattern
            verifies that an unquoted <code>@</code> sign exists.</blockquote>
        payer_id (str): The account identifier for a PayPal account.
        name (Name): The name of the party.
        phone (PhoneWithType): The phone information.
        address (Address): The portable international postal address. Maps to
            [AddressValidationMetadata](https://github.com/googlei18n/libaddres
            sinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling
            form controls: the autocomplete
            attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-
            form-controls-the-autocomplete-attribute).
        user_name (str): The Venmo username, as chosen by the user.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "description": 'description',
        "shipping": 'shipping',
        "permit_multiple_payment_tokens": 'permit_multiple_payment_tokens',
        "usage_type": 'usage_type',
        "customer_type": 'customer_type',
        "email_address": 'email_address',
        "payer_id": 'payer_id',
        "name": 'name',
        "phone": 'phone',
        "address": 'address',
        "user_name": 'user_name'
    }

    _optionals = [
        'description',
        'shipping',
        'permit_multiple_payment_tokens',
        'usage_type',
        'customer_type',
        'email_address',
        'payer_id',
        'name',
        'phone',
        'address',
        'user_name',
    ]

    def __init__(self,
                 description=APIHelper.SKIP,
                 shipping=APIHelper.SKIP,
                 permit_multiple_payment_tokens=False,
                 usage_type=APIHelper.SKIP,
                 customer_type=APIHelper.SKIP,
                 email_address=APIHelper.SKIP,
                 payer_id=APIHelper.SKIP,
                 name=APIHelper.SKIP,
                 phone=APIHelper.SKIP,
                 address=APIHelper.SKIP,
                 user_name=APIHelper.SKIP):
        """Constructor for the VenmoPaymentToken class"""

        # Initialize members of the class
        if description is not APIHelper.SKIP:
            self.description = description 
        if shipping is not APIHelper.SKIP:
            self.shipping = shipping 
        self.permit_multiple_payment_tokens = permit_multiple_payment_tokens 
        if usage_type is not APIHelper.SKIP:
            self.usage_type = usage_type 
        if customer_type is not APIHelper.SKIP:
            self.customer_type = customer_type 
        if email_address is not APIHelper.SKIP:
            self.email_address = email_address 
        if payer_id is not APIHelper.SKIP:
            self.payer_id = payer_id 
        if name is not APIHelper.SKIP:
            self.name = name 
        if phone is not APIHelper.SKIP:
            self.phone = phone 
        if address is not APIHelper.SKIP:
            self.address = address 
        if user_name is not APIHelper.SKIP:
            self.user_name = user_name 

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates 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
        description = dictionary.get("description") if dictionary.get("description") else APIHelper.SKIP
        shipping = VaultedDigitalWalletShippingDetails.from_dictionary(dictionary.get('shipping')) if 'shipping' in dictionary.keys() else APIHelper.SKIP
        permit_multiple_payment_tokens = dictionary.get("permit_multiple_payment_tokens") if dictionary.get("permit_multiple_payment_tokens") else False
        usage_type = dictionary.get("usage_type") if dictionary.get("usage_type") else APIHelper.SKIP
        customer_type = dictionary.get("customer_type") if dictionary.get("customer_type") else APIHelper.SKIP
        email_address = dictionary.get("email_address") if dictionary.get("email_address") else APIHelper.SKIP
        payer_id = dictionary.get("payer_id") if dictionary.get("payer_id") else APIHelper.SKIP
        name = Name.from_dictionary(dictionary.get('name')) if 'name' in dictionary.keys() else APIHelper.SKIP
        phone = PhoneWithType.from_dictionary(dictionary.get('phone')) if 'phone' in dictionary.keys() else APIHelper.SKIP
        address = Address.from_dictionary(dictionary.get('address')) if 'address' in dictionary.keys() else APIHelper.SKIP
        user_name = dictionary.get("user_name") if dictionary.get("user_name") else APIHelper.SKIP
        # Return an object of this model
        return cls(description,
                   shipping,
                   permit_multiple_payment_tokens,
                   usage_type,
                   customer_type,
                   email_address,
                   payer_id,
                   name,
                   phone,
                   address,
                   user_name)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'description={(self.description if hasattr(self, "description") else None)!r}, '
                f'shipping={(self.shipping if hasattr(self, "shipping") else None)!r}, '
                f'permit_multiple_payment_tokens={(self.permit_multiple_payment_tokens if hasattr(self, "permit_multiple_payment_tokens") else None)!r}, '
                f'usage_type={(self.usage_type if hasattr(self, "usage_type") else None)!r}, '
                f'customer_type={(self.customer_type if hasattr(self, "customer_type") else None)!r}, '
                f'email_address={(self.email_address if hasattr(self, "email_address") else None)!r}, '
                f'payer_id={(self.payer_id if hasattr(self, "payer_id") else None)!r}, '
                f'name={(self.name if hasattr(self, "name") else None)!r}, '
                f'phone={(self.phone if hasattr(self, "phone") else None)!r}, '
                f'address={(self.address if hasattr(self, "address") else None)!r}, '
                f'user_name={(self.user_name if hasattr(self, "user_name") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'description={(self.description if hasattr(self, "description") else None)!s}, '
                f'shipping={(self.shipping if hasattr(self, "shipping") else None)!s}, '
                f'permit_multiple_payment_tokens={(self.permit_multiple_payment_tokens if hasattr(self, "permit_multiple_payment_tokens") else None)!s}, '
                f'usage_type={(self.usage_type if hasattr(self, "usage_type") else None)!s}, '
                f'customer_type={(self.customer_type if hasattr(self, "customer_type") else None)!s}, '
                f'email_address={(self.email_address if hasattr(self, "email_address") else None)!s}, '
                f'payer_id={(self.payer_id if hasattr(self, "payer_id") else None)!s}, '
                f'name={(self.name if hasattr(self, "name") else None)!s}, '
                f'phone={(self.phone if hasattr(self, "phone") else None)!s}, '
                f'address={(self.address if hasattr(self, "address") else None)!s}, '
                f'user_name={(self.user_name if hasattr(self, "user_name") else None)!s})')
