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

"""
    apimaticcalculatorlatest

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

import dateutil.parser

class AvailableCount(object):

    """Implementation of the 'AvailableCount' model.

    TODO: type model description here.

    Attributes:
        begin_date (date): Beginning date of date range for which count is
            applied. Date should be in format "yyyy-MM-dd"
        end_date (date): End date of date range for which count  is applied.
            Date should be in format "yyyy-MM-dd"
        count (int): Number of available rooms

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "begin_date":'beginDate',
        "end_date":'endDate',
        "count":'count'
    }

    def __init__(self,
                 begin_date=None,
                 end_date=None,
                 count=None):
        """Constructor for the AvailableCount class"""

        # Initialize members of the class
        self.begin_date = begin_date
        self.end_date = end_date
        self.count = count


    @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_date = dateutil.parser.parse(dictionary.get('beginDate')).date() if dictionary.get('beginDate') else None
        end_date = dateutil.parser.parse(dictionary.get('endDate')).date() if dictionary.get('endDate') else None
        count = dictionary.get('count')

        # Return an object of this model
        return cls(begin_date,
                   end_date,
                   count)


