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

"""
pqapiv2

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from pqapiv2.models.key_value_pair_bank_field_types_string import KeyValuePairBankFieldTypesString


class BankAccountFields(object):

    """Implementation of the '_bankAccountFields' model.

    Classifies account field objects

    Attributes:
        bank_account_ownership_type (BankAccountOwnershipTypesEnum): Account
            ownership types
        mtype (BankAccountTypesEnum): Financial purpose of the bank account
            (<i>Savings</i>, <i>Investment</i>)
        fields (list of KeyValuePairBankFieldTypesString): TODO: type
            description here.
        bank_currency (CurrencyTypesEnum): Currency code type for the object
        bank_country (CountryTypesEnum): Two-digit country code types
        description (string): User-supplied description of the bank account
            for reference

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "bank_account_ownership_type": 'bankAccountOwnershipType',
        "mtype": 'type',
        "fields": 'fields',
        "bank_currency": 'bankCurrency',
        "bank_country": 'bankCountry',
        "description": 'description'
    }

    def __init__(self,
                 bank_account_ownership_type=None,
                 mtype=None,
                 fields=None,
                 bank_currency=None,
                 bank_country=None,
                 description=None):
        """Constructor for the BankAccountFields class"""

        # Initialize members of the class
        self.bank_account_ownership_type = bank_account_ownership_type
        self.mtype = mtype
        self.fields = fields
        self.bank_currency = bank_currency
        self.bank_country = bank_country
        self.description = description

    @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 dictionary is None:
            return None

        # Extract variables from the dictionary
        bank_account_ownership_type = dictionary.get('bankAccountOwnershipType')
        mtype = dictionary.get('type')
        fields = None
        if dictionary.get('fields') is not None:
            fields = [KeyValuePairBankFieldTypesString.from_dictionary(x) for x in dictionary.get('fields')]
        bank_currency = dictionary.get('bankCurrency')
        bank_country = dictionary.get('bankCountry')
        description = dictionary.get('description')

        # Return an object of this model
        return cls(bank_account_ownership_type,
                   mtype,
                   fields,
                   bank_currency,
                   bank_country,
                   description)
