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

"""
paypalserversdk

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from paypalserversdk.api_helper import APIHelper
from paypalserversdk.models.bank_request import BankRequest
from paypalserversdk.models.setup_token_request_card import SetupTokenRequestCard
from paypalserversdk.models.vault_apple_pay_request import VaultApplePayRequest
from paypalserversdk.models.vault_paypal_wallet_request import VaultPaypalWalletRequest
from paypalserversdk.models.vault_token_request import VaultTokenRequest
from paypalserversdk.models.vault_venmo_request import VaultVenmoRequest


class SetupTokenRequestPaymentSource(object):

    """Implementation of the 'Setup Token Request Payment Source' model.

    The payment method to vault with the instrument details.

    Attributes:
        card (SetupTokenRequestCard): A Resource representing a request to
            vault a Card.
        paypal (VaultPaypalWalletRequest): A resource representing a request
            to vault PayPal Wallet.
        venmo (VaultVenmoRequest): A resource representing a request to vault
            Venmo.
        apple_pay (VaultApplePayRequest): A resource representing a request to
            vault Apple Pay.
        token (VaultTokenRequest): The Tokenized Payment Source representing a
            Request to Vault a Token.
        bank (BankRequest): A Resource representing a request to vault a Bank
            used for ACH Debit.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "card": 'card',
        "paypal": 'paypal',
        "venmo": 'venmo',
        "apple_pay": 'apple_pay',
        "token": 'token',
        "bank": 'bank'
    }

    _optionals = [
        'card',
        'paypal',
        'venmo',
        'apple_pay',
        'token',
        'bank',
    ]

    def __init__(self,
                 card=APIHelper.SKIP,
                 paypal=APIHelper.SKIP,
                 venmo=APIHelper.SKIP,
                 apple_pay=APIHelper.SKIP,
                 token=APIHelper.SKIP,
                 bank=APIHelper.SKIP):
        """Constructor for the SetupTokenRequestPaymentSource class"""

        # Initialize members of the class
        if card is not APIHelper.SKIP:
            self.card = card 
        if paypal is not APIHelper.SKIP:
            self.paypal = paypal 
        if venmo is not APIHelper.SKIP:
            self.venmo = venmo 
        if apple_pay is not APIHelper.SKIP:
            self.apple_pay = apple_pay 
        if token is not APIHelper.SKIP:
            self.token = token 
        if bank is not APIHelper.SKIP:
            self.bank = bank 

    @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
        card = SetupTokenRequestCard.from_dictionary(dictionary.get('card')) if 'card' in dictionary.keys() else APIHelper.SKIP
        paypal = VaultPaypalWalletRequest.from_dictionary(dictionary.get('paypal')) if 'paypal' in dictionary.keys() else APIHelper.SKIP
        venmo = VaultVenmoRequest.from_dictionary(dictionary.get('venmo')) if 'venmo' in dictionary.keys() else APIHelper.SKIP
        apple_pay = VaultApplePayRequest.from_dictionary(dictionary.get('apple_pay')) if 'apple_pay' in dictionary.keys() else APIHelper.SKIP
        token = VaultTokenRequest.from_dictionary(dictionary.get('token')) if 'token' in dictionary.keys() else APIHelper.SKIP
        bank = BankRequest.from_dictionary(dictionary.get('bank')) if 'bank' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(card,
                   paypal,
                   venmo,
                   apple_pay,
                   token,
                   bank)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'card={(self.card if hasattr(self, "card") else None)!r}, '
                f'paypal={(self.paypal if hasattr(self, "paypal") else None)!r}, '
                f'venmo={(self.venmo if hasattr(self, "venmo") else None)!r}, '
                f'apple_pay={(self.apple_pay if hasattr(self, "apple_pay") else None)!r}, '
                f'token={(self.token if hasattr(self, "token") else None)!r}, '
                f'bank={(self.bank if hasattr(self, "bank") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'card={(self.card if hasattr(self, "card") else None)!s}, '
                f'paypal={(self.paypal if hasattr(self, "paypal") else None)!s}, '
                f'venmo={(self.venmo if hasattr(self, "venmo") else None)!s}, '
                f'apple_pay={(self.apple_pay if hasattr(self, "apple_pay") else None)!s}, '
                f'token={(self.token if hasattr(self, "token") else None)!s}, '
                f'bank={(self.bank if hasattr(self, "bank") else None)!s})')
