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

"""
    apimaticcalculatorlatest

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

import apimaticcalculatorlatest.models.asynchronous_validationmodel

class ValidationAsynchronouspushmessagerequest(object):

    """Implementation of the 'ValidationAsynchronouspushmessagerequest' model.

    Request for validation messages which BookingPal push asynchronous
    (webhooks request)

    Attributes:
        supplier_id (int): Id of supplier in BookingPal
        mtype (string): TODO: type description here.
        validation (list of AsynchronousValidationmodel): Validation Model

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "supplier_id":'supplierId',
        "mtype":'type',
        "validation":'validation'
    }

    def __init__(self,
                 supplier_id=None,
                 mtype='BP_VALIDATION',
                 validation=None):
        """Constructor for the ValidationAsynchronouspushmessagerequest class"""

        # Initialize members of the class
        self.supplier_id = supplier_id
        self.mtype = mtype
        self.validation = validation


    @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
        supplier_id = dictionary.get('supplierId')
        mtype = dictionary.get("type") if dictionary.get("type") else 'BP_VALIDATION'
        validation = None
        if dictionary.get('validation') != None:
            validation = list()
            for structure in dictionary.get('validation'):
                validation.append(apimaticcalculatorlatest.models.asynchronous_validationmodel.AsynchronousValidationmodel.from_dictionary(structure))

        # Return an object of this model
        return cls(supplier_id,
                   mtype,
                   validation)


