# -*- 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


class VaultSEPADebitResponse(object):

    """Implementation of the 'Vault SEPA Debit Response' model.

    An API resource used in the response of securely storing a SEPA Debit.

    Attributes:
        iban_last_chars (str): The last characters of the IBAN used to pay.
        account_holder_name (Any): The model property of type Any.
        billing_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).

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "iban_last_chars": 'iban_last_chars',
        "account_holder_name": 'account_holder_name',
        "billing_address": 'billing_address'
    }

    _optionals = [
        'iban_last_chars',
        'account_holder_name',
        'billing_address',
    ]

    def __init__(self,
                 iban_last_chars=APIHelper.SKIP,
                 account_holder_name=APIHelper.SKIP,
                 billing_address=APIHelper.SKIP):
        """Constructor for the VaultSEPADebitResponse class"""

        # Initialize members of the class
        if iban_last_chars is not APIHelper.SKIP:
            self.iban_last_chars = iban_last_chars 
        if account_holder_name is not APIHelper.SKIP:
            self.account_holder_name = account_holder_name 
        if billing_address is not APIHelper.SKIP:
            self.billing_address = billing_address 

    @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
        iban_last_chars = dictionary.get("iban_last_chars") if dictionary.get("iban_last_chars") else APIHelper.SKIP
        account_holder_name = dictionary.get("account_holder_name") if dictionary.get("account_holder_name") else APIHelper.SKIP
        billing_address = Address.from_dictionary(dictionary.get('billing_address')) if 'billing_address' in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(iban_last_chars,
                   account_holder_name,
                   billing_address)

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

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