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

"""
    apimaticcalculatorlatest

    This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""

import apimaticcalculatorlatest.models.message_model

class MessagesModel(object):

    """Implementation of the 'MessagesModel' model.

    List of messages Model

    Attributes:
        messages (list of MessageModel): List of models

    """

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

    def __init__(self,
                 messages=None):
        """Constructor for the MessagesModel class"""

        # Initialize members of the class
        self.messages = messages


    @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
        messages = None
        if dictionary.get('messages') != None:
            messages = list()
            for structure in dictionary.get('messages'):
                messages.append(apimaticcalculatorlatest.models.message_model.MessageModel.from_dictionary(structure))

        # Return an object of this model
        return cls(messages)


