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

"""
    apimaticcalculatorlatest

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

import dateutil.parser

class LosRate(object):

    """Implementation of the 'LosRate' model.

    Model for LOS (Length of stay) rates

    Attributes:
        check_in_date (date): Check-in Date. Date should be in format
            "yyyy-MM-dd"
        max_guests (int): Max guests for check in date
        los_value (list of float): List rates value per day. First value is
            for reservation for 1 day. Secoon. If you do not support booking
            for some specific number of days, set value 0 for that element in
            array.nd value is for reservation for 2 days, and so on. If you do
            not support booking for some specific number of days, set value 0
            for that element in array.
        currency (string): Currency for rates. It will be visiable only in GET
            response. You should not set this field in request since we will
            use product currency for every rate.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "check_in_date":'checkInDate',
        "max_guests":'maxGuests',
        "los_value":'losValue',
        "currency":'currency'
    }

    def __init__(self,
                 check_in_date=None,
                 max_guests=None,
                 los_value=None,
                 currency=None):
        """Constructor for the LosRate class"""

        # Initialize members of the class
        self.check_in_date = check_in_date
        self.max_guests = max_guests
        self.los_value = los_value
        self.currency = currency


    @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
        check_in_date = dateutil.parser.parse(dictionary.get('checkInDate')).date() if dictionary.get('checkInDate') else None
        max_guests = dictionary.get('maxGuests')
        los_value = dictionary.get('losValue')
        currency = dictionary.get('currency')

        # Return an object of this model
        return cls(check_in_date,
                   max_guests,
                   los_value,
                   currency)


