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

"""
    apimaticcalculatorlatest

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

import apimaticcalculatorlatest.models.myield

class TransportYield(object):

    """Implementation of the 'TransportYield' model.

    TODO: type model description here.

    Attributes:
        product_id (int): ID of the product
        weekend (list of Yield): Set a specific date range in which you would
            like to manipulate the basic price per night on weekends.  For
            example you will set the YMR date range from 01.07.2016-31.07.2016
            param - (Friday, Saturday=0; Saturday, Sunday=1) yield amount = 20
            modifier - Increase Percent Price per night in the period from
            01.07.2016 to 31.07.2016 will be 100 USD in working days and 100 +
            20% = 120 USD in weekends (Friday, Saturday or Saturday, Sunday,
            depending on what was selected).
        length_of_stay (list of Yield): Automatically applies price
            modifications to inquiries based on the number of nights the
            inquiries are for.  For example you will set the YMR date range
            from 01.07.2016-31.07.2017 param - {Length of Stay}. Let’s say you
            set 15 days. yield amount = 5 modifier - Decrease Percent Price
            per night if you made a reservation for 15 or more days will be
            100 - 5% = 95 USD
        date_range (list of Yield): Set a specific date range in which you
            would like to manipulate the basic price per night.  For example
            you will set the YMR date range from 01.07.2016-31.07.2016 yield
            amount = 20 modifier - Increase Percent Price per night in the
            period from 01.07.2016 to 31.07.2016 will be 100 + 20% = 120 USD

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "product_id":'productId',
        "weekend":'weekend',
        "length_of_stay":'lengthOfStay',
        "date_range":'dateRange'
    }

    def __init__(self,
                 product_id=None,
                 weekend=None,
                 length_of_stay=None,
                 date_range=None):
        """Constructor for the TransportYield class"""

        # Initialize members of the class
        self.product_id = product_id
        self.weekend = weekend
        self.length_of_stay = length_of_stay
        self.date_range = date_range


    @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
        product_id = dictionary.get('productId')
        weekend = None
        if dictionary.get('weekend') != None:
            weekend = list()
            for structure in dictionary.get('weekend'):
                weekend.append(apimaticcalculatorlatest.models.myield.Yield.from_dictionary(structure))
        length_of_stay = None
        if dictionary.get('lengthOfStay') != None:
            length_of_stay = list()
            for structure in dictionary.get('lengthOfStay'):
                length_of_stay.append(apimaticcalculatorlatest.models.myield.Yield.from_dictionary(structure))
        date_range = None
        if dictionary.get('dateRange') != None:
            date_range = list()
            for structure in dictionary.get('dateRange'):
                date_range.append(apimaticcalculatorlatest.models.myield.Yield.from_dictionary(structure))

        # Return an object of this model
        return cls(product_id,
                   weekend,
                   length_of_stay,
                   date_range)


