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

"""
pqapiv2

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from pqapiv2.models.bank_account_requirement_format import BankAccountRequirementFormat
from pqapiv2.models.bank_account_requirement_validator import BankAccountRequirementValidator
from pqapiv2.models.key_value_pair_language_type_string import KeyValuePairLanguageTypeString


class BankAccountRequiredFields(object):

    """Implementation of the '_bankAccountRequiredFields' model.

    Classifies the required account field objects

    Attributes:
        format (BankAccountRequirementFormat): Classifies the format of the
            required information for a bank account
        requirement (BankAccountFieldTypesEnum): Classifies account field
            types
        description (list of KeyValuePairLanguageTypeString): Localized
            requirement description for display purposes
        validators (list of BankAccountRequirementValidator): TODO: type
            description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "format": 'format',
        "requirement": 'requirement',
        "description": 'description',
        "validators": 'validators'
    }

    def __init__(self,
                 format=None,
                 requirement=None,
                 description=None,
                 validators=None):
        """Constructor for the BankAccountRequiredFields class"""

        # Initialize members of the class
        self.format = format
        self.requirement = requirement
        self.description = description
        self.validators = validators

    @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
        format = BankAccountRequirementFormat.from_dictionary(dictionary.get('format')) if dictionary.get('format') else None
        requirement = dictionary.get('requirement')
        description = None
        if dictionary.get('description') is not None:
            description = [KeyValuePairLanguageTypeString.from_dictionary(x) for x in dictionary.get('description')]
        validators = None
        if dictionary.get('validators') is not None:
            validators = [BankAccountRequirementValidator.from_dictionary(x) for x in dictionary.get('validators')]

        # Return an object of this model
        return cls(format,
                   requirement,
                   description,
                   validators)
