# -*- 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.ach_debit_response import ACHDebitResponse
from paypalrestapis.models.sepa_debit_response import SEPADebitResponse


class BankPaymentToken(object):

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

    Full representation of a Bank Payment Token.

    Attributes:
        ach_debit (ACHDebitResponse): A Resource representing a response of
            vaulted a ACH Debit Account.
        sepa_debit (SEPADebitResponse): The model property of type
            SEPADebitResponse.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "ach_debit": 'ach_debit',
        "sepa_debit": 'sepa_debit'
    }

    _optionals = [
        'ach_debit',
        'sepa_debit',
    ]

    def __init__(self,
                 ach_debit=APIHelper.SKIP,
                 sepa_debit=APIHelper.SKIP):
        """Constructor for the BankPaymentToken class"""

        # Initialize members of the class
        if ach_debit is not APIHelper.SKIP:
            self.ach_debit = ach_debit 
        if sepa_debit is not APIHelper.SKIP:
            self.sepa_debit = sepa_debit 

    @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
        ach_debit = ACHDebitResponse.from_dictionary(dictionary.get('ach_debit')) if 'ach_debit' in dictionary.keys() else APIHelper.SKIP
        sepa_debit = SEPADebitResponse.from_dictionary(dictionary.get('sepa_debit')) if 'sepa_debit' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(ach_debit,
                   sepa_debit)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'ach_debit={(self.ach_debit if hasattr(self, "ach_debit") else None)!r}, '
                f'sepa_debit={(self.sepa_debit if hasattr(self, "sepa_debit") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'ach_debit={(self.ach_debit if hasattr(self, "ach_debit") else None)!s}, '
                f'sepa_debit={(self.sepa_debit if hasattr(self, "sepa_debit") else None)!s})')
