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

"""
    greenbyteapi

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

from greenbyteapi.api_helper import APIHelper

class DowntimeEvent(object):

    """Implementation of the 'DowntimeEvent' model.

    A downtime event.

    Attributes:
        downtime_event_id (int): The id of a downtime event.
        timestamp_start (datetime): The timestamp when the downtime is/was
            planned to start. The timestamp is in the time zone configured in
            the Greenbyte Platform without UTC offset.
        timestamp_end (datetime): The timestamp when the downtime is/was
            planned to end. The timestamp is in the time zone configured in
            the Greenbyte Platform without UTC offset.
        comment (string): A comment describing the downtime event.
        device_ids (list of int): TODO: type description here.
        site_ids (list of int): TODO: type description here.
        task_ids (list of int): TODO: type description here.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "downtime_event_id":'downtimeEventId',
        "timestamp_start":'timestampStart',
        "timestamp_end":'timestampEnd',
        "comment":'comment',
        "device_ids":'deviceIds',
        "site_ids":'siteIds',
        "task_ids":'taskIds'
    }

    def __init__(self,
                 downtime_event_id=None,
                 timestamp_start=None,
                 timestamp_end=None,
                 comment=None,
                 device_ids=None,
                 site_ids=None,
                 task_ids=None):
        """Constructor for the DowntimeEvent class"""

        # Initialize members of the class
        self.downtime_event_id = downtime_event_id
        self.timestamp_start = APIHelper.RFC3339DateTime(timestamp_start) if timestamp_start else None
        self.timestamp_end = APIHelper.RFC3339DateTime(timestamp_end) if timestamp_end else None
        self.comment = comment
        self.device_ids = device_ids
        self.site_ids = site_ids
        self.task_ids = task_ids


    @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
        downtime_event_id = dictionary.get('downtimeEventId')
        timestamp_start = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestampStart")).datetime if dictionary.get("timestampStart") else None
        timestamp_end = APIHelper.RFC3339DateTime.from_value(dictionary.get("timestampEnd")).datetime if dictionary.get("timestampEnd") else None
        comment = dictionary.get('comment')
        device_ids = dictionary.get('deviceIds')
        site_ids = dictionary.get('siteIds')
        task_ids = dictionary.get('taskIds')

        # Return an object of this model
        return cls(downtime_event_id,
                   timestamp_start,
                   timestamp_end,
                   comment,
                   device_ids,
                   site_ids,
                   task_ids)


