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

"""
pqapiv2

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


class BankAccountRequirementFormat(object):

    """Implementation of the '_bankAccountRequirementFormat' model.

    Classifies the format of the required information for a bank account

    Attributes:
        example (string): Example of a requirement generated from the
            validator(s)
        legend (list of BankAccountRequirementFormatLegend): TODO: type
            description here.

    """

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

    def __init__(self,
                 example=None,
                 legend=None):
        """Constructor for the BankAccountRequirementFormat class"""

        # Initialize members of the class
        self.example = example
        self.legend = legend

    @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
        example = dictionary.get('example')
        legend = None
        if dictionary.get('legend') is not None:
            legend = [BankAccountRequirementFormatLegend.from_dictionary(x) for x in dictionary.get('legend')]

        # Return an object of this model
        return cls(example,
                   legend)
