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

"""
    greenbyteapi

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

import greenbyteapi.models.power_curve_value

class PowerCurve(object):

    """Implementation of the 'PowerCurve' model.

    TODO: type model description here.

    Attributes:
        device_id (int): The id of a device.
        title (string): The title of the power curve.
        values (list of PowerCurveValue): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "device_id":'deviceId',
        "title":'title',
        "values":'values'
    }

    def __init__(self,
                 device_id=None,
                 title=None,
                 values=None):
        """Constructor for the PowerCurve class"""

        # Initialize members of the class
        self.device_id = device_id
        self.title = title
        self.values = values


    @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
        device_id = dictionary.get('deviceId')
        title = dictionary.get('title')
        values = None
        if dictionary.get('values') != None:
            values = list()
            for structure in dictionary.get('values'):
                values.append(greenbyteapi.models.power_curve_value.PowerCurveValue.from_dictionary(structure))

        # Return an object of this model
        return cls(device_id,
                   title,
                   values)


