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

"""
    greenbyteapi

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


class DataPerCategoryItem(object):

    """Implementation of the 'DataPerCategoryItem' model.

    Data for a single aggregate group and contract category combination.

    Attributes:
        aggregate_id (int): The id of this aggregate group: device id, site
            id, or the constant -1 for portfolio. For `siteLevel` aggregation
            a generated unique id is used.
        aggregate_path_names (list of string): For `siteLevel` aggregation
            this contains the title for each level in the hierarchy. For other
            types of aggregation it will be empty.
        device_ids (list of int): The ids of the devices in this aggregate
            group.
        contract_title (string): TODO: type description here.
        category_title (string): TODO: type description here.
        category_time (CategoryTimeEnum): TODO: type description here.
        value (float): The aggregated value of the selected data signal.
        duration (float): The summed duration in seconds allocated to this
            contract category and aggregate group.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "aggregate_id":'aggregateId',
        "device_ids":'deviceIds',
        "contract_title":'contractTitle',
        "category_title":'categoryTitle',
        "category_time":'categoryTime',
        "value":'value',
        "aggregate_path_names":'aggregatePathNames',
        "duration":'duration'
    }

    def __init__(self,
                 aggregate_id=None,
                 device_ids=None,
                 contract_title=None,
                 category_title=None,
                 category_time=None,
                 value=None,
                 aggregate_path_names=None,
                 duration=None):
        """Constructor for the DataPerCategoryItem class"""

        # Initialize members of the class
        self.aggregate_id = aggregate_id
        self.aggregate_path_names = aggregate_path_names
        self.device_ids = device_ids
        self.contract_title = contract_title
        self.category_title = category_title
        self.category_time = category_time
        self.value = value
        self.duration = duration


    @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
        aggregate_id = dictionary.get('aggregateId')
        device_ids = dictionary.get('deviceIds')
        contract_title = dictionary.get('contractTitle')
        category_title = dictionary.get('categoryTitle')
        category_time = dictionary.get('categoryTime')
        value = dictionary.get('value')
        aggregate_path_names = dictionary.get('aggregatePathNames')
        duration = dictionary.get('duration')

        # Return an object of this model
        return cls(aggregate_id,
                   device_ids,
                   contract_title,
                   category_title,
                   category_time,
                   value,
                   aggregate_path_names,
                   duration)


