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

"""
    apimaticcalculatorlatest

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

import dateutil.parser

class Fee(object):

    """Implementation of the 'Fee' model.

    TODO: type model description here.

    Attributes:
        begin_date (date): Fee applies from Date. Date should be in format
            "yyyy-MM-dd"
        end_date (date): Fee applies to Date. Date should be in format
            "yyyy-MM-dd"
        entity_type (FeeEntityTypeEnum): TODO: type description here.
        fee_type (FeeTypeEnum): TODO: type description here.
        option (int): Number of guests when set extra person fee. Only values
            >0 are allowed.
        name (string): Fee name.  For example: Extra person, Cleaning fee,
            Parking etc.
        tax_type (FeetaxTypeEnum): TODO: type description here.
        unit (FeeUnitEnum): TODO: type description here.
        value (float): Fee value
        value_type (FeeValueTypeEnum): Value Type {FLAT, PERCENT}
        alt_id (string): Alternative Id of the fee (fee id in your system)

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "entity_type":'entityType',
        "fee_type":'feeType',
        "name":'name',
        "unit":'unit',
        "value":'value',
        "value_type":'valueType',
        "begin_date":'beginDate',
        "end_date":'endDate',
        "option":'option',
        "tax_type":'taxType',
        "alt_id":'altId'
    }

    def __init__(self,
                 entity_type=None,
                 fee_type=None,
                 name=None,
                 unit=None,
                 value=None,
                 value_type=None,
                 begin_date=None,
                 end_date=None,
                 option=None,
                 tax_type=None,
                 alt_id=None):
        """Constructor for the Fee class"""

        # Initialize members of the class
        self.begin_date = begin_date
        self.end_date = end_date
        self.entity_type = entity_type
        self.fee_type = fee_type
        self.option = option
        self.name = name
        self.tax_type = tax_type
        self.unit = unit
        self.value = value
        self.value_type = value_type
        self.alt_id = alt_id


    @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
        entity_type = dictionary.get('entityType')
        fee_type = dictionary.get('feeType')
        name = dictionary.get('name')
        unit = dictionary.get('unit')
        value = dictionary.get('value')
        value_type = dictionary.get('valueType')
        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
        option = dictionary.get('option')
        tax_type = dictionary.get('taxType')
        alt_id = dictionary.get('altId')

        # Return an object of this model
        return cls(entity_type,
                   fee_type,
                   name,
                   unit,
                   value,
                   value_type,
                   begin_date,
                   end_date,
                   option,
                   tax_type,
                   alt_id)


