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

"""
    apimaticcalculatorlatest

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


class AsynchronousValidationmodel(object):

    """Implementation of the 'AsynchronousValidationmodel' model.

    Model for Validation messages

    Attributes:
        product_id (int): Id of product in BookingPal
        validation_errors (string): Error message - explanation what are
            problems if validation failed.
        valid (bool): Is product valid

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "product_id":'productId',
        "valid":'valid',
        "validation_errors":'validationErrors'
    }

    def __init__(self,
                 product_id=None,
                 valid=None,
                 validation_errors=None):
        """Constructor for the AsynchronousValidationmodel class"""

        # Initialize members of the class
        self.product_id = product_id
        self.validation_errors = validation_errors
        self.valid = valid


    @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
        product_id = dictionary.get('productId')
        valid = dictionary.get('valid')
        validation_errors = dictionary.get('validationErrors')

        # Return an object of this model
        return cls(product_id,
                   valid,
                   validation_errors)


