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

"""
    greenbyteapi

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

from greenbyteapi.api_helper import APIHelper

class TimeZoneConfiguration(object):

    """Implementation of the 'TimeZoneConfiguration' model.

    The time zone configuration.

    Attributes:
        title (string): The title of the time zone.
        utc_offset (float): The UTC offset for the time zone.
        utc_offset_dst (float): The UTC offset for the time zone during
            daylight savings time.
        dst_timestamp_start (datetime): The start of daylight savings time in
            the time zone. This timestamp is given in UTC.
        dst_timestamp_end (datetime): The end of daylight savings time in the
            time zone. This timestamp is given in UTC.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "title":'title',
        "utc_offset":'utcOffset',
        "utc_offset_dst":'utcOffsetDst',
        "dst_timestamp_start":'dstTimestampStart',
        "dst_timestamp_end":'dstTimestampEnd'
    }

    def __init__(self,
                 title=None,
                 utc_offset=None,
                 utc_offset_dst=None,
                 dst_timestamp_start=None,
                 dst_timestamp_end=None):
        """Constructor for the TimeZoneConfiguration class"""

        # Initialize members of the class
        self.title = title
        self.utc_offset = utc_offset
        self.utc_offset_dst = utc_offset_dst
        self.dst_timestamp_start = APIHelper.RFC3339DateTime(dst_timestamp_start) if dst_timestamp_start else None
        self.dst_timestamp_end = APIHelper.RFC3339DateTime(dst_timestamp_end) if dst_timestamp_end else None


    @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
        title = dictionary.get('title')
        utc_offset = dictionary.get('utcOffset')
        utc_offset_dst = dictionary.get('utcOffsetDst')
        dst_timestamp_start = APIHelper.RFC3339DateTime.from_value(dictionary.get("dstTimestampStart")).datetime if dictionary.get("dstTimestampStart") else None
        dst_timestamp_end = APIHelper.RFC3339DateTime.from_value(dictionary.get("dstTimestampEnd")).datetime if dictionary.get("dstTimestampEnd") else None

        # Return an object of this model
        return cls(title,
                   utc_offset,
                   utc_offset_dst,
                   dst_timestamp_start,
                   dst_timestamp_end)


