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

"""
cookiesapi

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from cookiesapi.models.time_spec import TimeSpec


class HoursRange(object):

    """Implementation of the 'HoursRange' model.

    Range/interval of hours.

    Attributes:
        begin (TimeSpec): Begin time for a given hours range.
        end (TimeSpec): End time for a given hours range.
        status (StoreStatusEnum): Status to apply for a store.
        active (bool): Whether this hours rule is active.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "begin": 'begin',
        "end": 'end',
        "status": 'status',
        "active": 'active'
    }

    def __init__(self,
                 begin=None,
                 end=None,
                 status=None,
                 active=None):
        """Constructor for the HoursRange class"""

        # Initialize members of the class
        self.begin = begin
        self.end = end
        self.status = status
        self.active = active

    @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
        begin = TimeSpec.from_dictionary(dictionary.get('begin')) if dictionary.get('begin') else None
        end = TimeSpec.from_dictionary(dictionary.get('end')) if dictionary.get('end') else None
        status = dictionary.get('status')
        active = dictionary.get('active')

        # Return an object of this model
        return cls(begin,
                   end,
                   status,
                   active)
