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

"""
    apimaticcalculatorlatest

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

import apimaticcalculatorlatest.models.los_rate

class LosRatesProduct(object):

    """Implementation of the 'LosRatesProduct' model.

    Model for product LOS rates

    Attributes:
        product_id (int): ID of the product
        los_rates (list of LosRate): List of models. Max size array for
            LosRates object 1000

    """

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

    def __init__(self,
                 product_id=None,
                 los_rates=None):
        """Constructor for the LosRatesProduct class"""

        # Initialize members of the class
        self.product_id = product_id
        self.los_rates = los_rates


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

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


