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

"""
cookiesapi

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


class RegularHours(object):

    """Implementation of the 'RegularHours' model.

    Describes regular store hours.

    Attributes:
        day (list of string): Days which a given regular hours rule applies
            to.
        hours (list of HoursRange): Hours to apply on the specified days.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "day": 'day',
        "hours": 'hours'
    }

    def __init__(self,
                 day=None,
                 hours=None):
        """Constructor for the RegularHours class"""

        # Initialize members of the class
        self.day = day
        self.hours = hours

    @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
        day = dictionary.get('day')
        hours = None
        if dictionary.get('hours') is not None:
            hours = [HoursRange.from_dictionary(x) for x in dictionary.get('hours')]

        # Return an object of this model
        return cls(day,
                   hours)
