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

"""
    healthoslib.models.similar_medicines_response
 
    This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) on 02/18/2017
"""
import healthoslib.models.constituent
import healthoslib.models.schedule
import healthoslib.models.base_model

class SimilarMedicinesResponse(healthoslib.models.base_model.BaseModel):

    """Implementation of the 'Similar MedicinesResponse' model.

    TODO: type model description here.

    Attributes:
        name (string): TODO: type description here.
        form (string): TODO: type description here.
        standard_units (int): TODO: type description here.
        package_form (string): TODO: type description here.
        price (float): TODO: type description here.
        size (string): TODO: type description here.
        manufacturer (string): TODO: type description here.
        constituents (list of Constituent): TODO: type description here.
        schedule (Schedule): TODO: type description here.
        medicine_id (string): TODO: type description here.

    """

    def __init__(self, 
                 name = None,
                 form = None,
                 standard_units = None,
                 package_form = None,
                 price = None,
                 size = None,
                 manufacturer = None,
                 constituents = None,
                 schedule = None,
                 medicine_id = None):
        """Constructor for the SimilarMedicinesResponse class"""
        
        # Initialize members of the class
        self.name = name
        self.form = form
        self.standard_units = standard_units
        self.package_form = package_form
        self.price = price
        self.size = size
        self.manufacturer = manufacturer
        self.constituents = constituents
        self.schedule = schedule
        self.medicine_id = medicine_id

        # Create a mapping from Model property names to API property names
        self.names = {
            "name" : "name",
            "form" : "form",
            "standard_units" : "standardUnits",
            "package_form" : "packageForm",
            "price" : "price",
            "size" : "size",
            "manufacturer" : "manufacturer",
            "constituents" : "constituents",
            "schedule" : "schedule",
            "medicine_id" : "medicine_id",
        }


    @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 == None:
            return None
        else:
            # Extract variables from the dictionary
            name = dictionary.get("name")
            form = dictionary.get("form")
            standard_units = dictionary.get("standardUnits")
            package_form = dictionary.get("packageForm")
            price = dictionary.get("price")
            size = dictionary.get("size")
            manufacturer = dictionary.get("manufacturer")
            constituents = None
            if dictionary.get("constituents") != None:
                constituents = list()
                for structure in dictionary.get("constituents"):
                    constituents.append(healthoslib.models.constituent.Constituent.from_dictionary(structure))
            schedule = healthoslib.models.schedule.Schedule.from_dictionary(dictionary.get("schedule")) if dictionary.get("schedule") else None
            medicine_id = dictionary.get("medicine_id")
            # Return an object of this model
            return cls(name,
                       form,
                       standard_units,
                       package_form,
                       price,
                       size,
                       manufacturer,
                       constituents,
                       schedule,
                       medicine_id)


