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

"""
    apimaticcalculatorlatest

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

import dateutil.parser
import apimaticcalculatorlatest.models.notes
import apimaticcalculatorlatest.models.attributes_with_quantity
import apimaticcalculatorlatest.models.nearby_amenity
import apimaticcalculatorlatest.models.bedroom_configuration
import apimaticcalculatorlatest.models.policy
import apimaticcalculatorlatest.models.location

class Property(object):

    """Implementation of the 'Property' model.

    TODO: type model description here.

    Attributes:
        name (string): Name of the property to display in the list
        id (int): Property ID in BookingPal
        alt_id (int): Alternative Id of the property (ID in your PMS system). 
            Note: this field you can not update, so this field will not be
            used during update.
        supplier_id (int): Id of the Property Manager (not be used for
            creating new property. Property will have ID of current authorized
            user)
        rooms (int): Number of bedrooms. Number of bedrooms should be > 0.
            Value 0 is only allowed in case property type  is Studio (PCT46 or
            PCT110)
        bathrooms (int): Number of bathrooms
        toilets (int): Number of toilets
        total_beds (int): Property’s total number of beds
        space (float): Property size
        space_unit (SpaceUnitEnum): TODO: type description here.
        persons (int): Maximum number of allowed adults
        childs (int): Number of allowed children (from 7 to 12 years)
        latitude (float): Latitude of the property (Must set field latitude
            and longitude or location)
        longitude (float): Longitude of the property (Must set field latitude
            and longitude or location)
        living_room (int): Number of Living rooms
        notes (Notes): Model where you can define different kinds of text
            values. If you need to delete some kind of texts, for example
            short description, you can do this on Update call (PUT), and you
            need to pass empty array for texts value, for example : 
            "shortDescription": {  "texts": [  ] }
        attributes_with_quantity (list of AttributesWithQuantity): Use this
            param instead of previous if you need to set quantity more than 1
            of attributes. If use both in POST request this will overwrite the
            previous list (under param attributes).
        nearby_amenities (list of NearbyAmenity): List of Nearby Attributes
            models. Check allowed values in Appendix.
        property_type (PropertyTypesEnum): TODO: type description here.
        bedroom_configuration (BedroomConfiguration): TODO: type description
            here.
        check_in_time (string): Time of Check in (HH:MM:SS)
        check_in_to_time (string): Time Check in to (HH:MM:SS)
        check_out_time (string): Time of Check out (HH:MM:SS)
        currency (string): Property currency. ISO 4217 code is required.
        policy (Policy): TODO: type description here.
        location (Location): TODO: type description here.
        supported_los_rates (bool): If true - means that the property supports
            only LOS rates. So daily rates can not be sent and updated.
            Default is false.
        tax_number (string): Tax number for product
        tourist_license_number (string): Tourist license number
        tourist_license_expiry_date (date): Tourist license expiry date.
            Correct date format is YYYY-MM-DD.
        multi_unit (MultiUnitEnum): Enum for product multyunit type.
        parent_id (int): This fields should not be used unless your property
            is not MLT (check field multiunit). In this case you must set
            owner (parent) id property to which this property will belong.
            Also you can not update this property.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name":'name',
        "rooms":'rooms',
        "bathrooms":'bathrooms',
        "persons":'persons',
        "property_type":'propertyType',
        "currency":'currency',
        "supported_los_rates":'supportedLosRates',
        "id":'id',
        "alt_id":'altId',
        "supplier_id":'supplierId',
        "toilets":'toilets',
        "total_beds":'totalBeds',
        "space":'space',
        "space_unit":'spaceUnit',
        "childs":'childs',
        "latitude":'latitude',
        "longitude":'longitude',
        "living_room":'livingRoom',
        "notes":'notes',
        "attributes_with_quantity":'attributesWithQuantity',
        "nearby_amenities":'nearbyAmenities',
        "bedroom_configuration":'bedroomConfiguration',
        "check_in_time":'checkInTime',
        "check_in_to_time":'checkInToTime',
        "check_out_time":'checkOutTime',
        "policy":'policy',
        "location":'location',
        "tax_number":'taxNumber',
        "tourist_license_number":'touristLicenseNumber',
        "tourist_license_expiry_date":'touristLicenseExpiryDate',
        "multi_unit":'multiUnit',
        "parent_id":'parentId'
    }

    def __init__(self,
                 name=None,
                 rooms=None,
                 bathrooms=None,
                 persons=None,
                 property_type=None,
                 currency=None,
                 supported_los_rates=None,
                 id=None,
                 alt_id=None,
                 supplier_id=None,
                 toilets=None,
                 total_beds=None,
                 space=None,
                 space_unit=None,
                 childs=None,
                 latitude=None,
                 longitude=None,
                 living_room=None,
                 notes=None,
                 attributes_with_quantity=None,
                 nearby_amenities=None,
                 bedroom_configuration=None,
                 check_in_time=None,
                 check_in_to_time=None,
                 check_out_time=None,
                 policy=None,
                 location=None,
                 tax_number=None,
                 tourist_license_number=None,
                 tourist_license_expiry_date=None,
                 multi_unit=None,
                 parent_id=None):
        """Constructor for the Property class"""

        # Initialize members of the class
        self.name = name
        self.id = id
        self.alt_id = alt_id
        self.supplier_id = supplier_id
        self.rooms = rooms
        self.bathrooms = bathrooms
        self.toilets = toilets
        self.total_beds = total_beds
        self.space = space
        self.space_unit = space_unit
        self.persons = persons
        self.childs = childs
        self.latitude = latitude
        self.longitude = longitude
        self.living_room = living_room
        self.notes = notes
        self.attributes_with_quantity = attributes_with_quantity
        self.nearby_amenities = nearby_amenities
        self.property_type = property_type
        self.bedroom_configuration = bedroom_configuration
        self.check_in_time = check_in_time
        self.check_in_to_time = check_in_to_time
        self.check_out_time = check_out_time
        self.currency = currency
        self.policy = policy
        self.location = location
        self.supported_los_rates = supported_los_rates
        self.tax_number = tax_number
        self.tourist_license_number = tourist_license_number
        self.tourist_license_expiry_date = tourist_license_expiry_date
        self.multi_unit = multi_unit
        self.parent_id = parent_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
        name = dictionary.get('name')
        rooms = dictionary.get('rooms')
        bathrooms = dictionary.get('bathrooms')
        persons = dictionary.get('persons')
        property_type = dictionary.get('propertyType')
        currency = dictionary.get('currency')
        supported_los_rates = dictionary.get('supportedLosRates')
        id = dictionary.get('id')
        alt_id = dictionary.get('altId')
        supplier_id = dictionary.get('supplierId')
        toilets = dictionary.get('toilets')
        total_beds = dictionary.get('totalBeds')
        space = dictionary.get('space')
        space_unit = dictionary.get('spaceUnit')
        childs = dictionary.get('childs')
        latitude = dictionary.get('latitude')
        longitude = dictionary.get('longitude')
        living_room = dictionary.get('livingRoom')
        notes = apimaticcalculatorlatest.models.notes.Notes.from_dictionary(dictionary.get('notes')) if dictionary.get('notes') else None
        attributes_with_quantity = None
        if dictionary.get('attributesWithQuantity') != None:
            attributes_with_quantity = list()
            for structure in dictionary.get('attributesWithQuantity'):
                attributes_with_quantity.append(apimaticcalculatorlatest.models.attributes_with_quantity.AttributesWithQuantity.from_dictionary(structure))
        nearby_amenities = None
        if dictionary.get('nearbyAmenities') != None:
            nearby_amenities = list()
            for structure in dictionary.get('nearbyAmenities'):
                nearby_amenities.append(apimaticcalculatorlatest.models.nearby_amenity.NearbyAmenity.from_dictionary(structure))
        bedroom_configuration = apimaticcalculatorlatest.models.bedroom_configuration.BedroomConfiguration.from_dictionary(dictionary.get('bedroomConfiguration')) if dictionary.get('bedroomConfiguration') else None
        check_in_time = dictionary.get('checkInTime')
        check_in_to_time = dictionary.get('checkInToTime')
        check_out_time = dictionary.get('checkOutTime')
        policy = apimaticcalculatorlatest.models.policy.Policy.from_dictionary(dictionary.get('policy')) if dictionary.get('policy') else None
        location = apimaticcalculatorlatest.models.location.Location.from_dictionary(dictionary.get('location')) if dictionary.get('location') else None
        tax_number = dictionary.get('taxNumber')
        tourist_license_number = dictionary.get('touristLicenseNumber')
        tourist_license_expiry_date = dateutil.parser.parse(dictionary.get('touristLicenseExpiryDate')).date() if dictionary.get('touristLicenseExpiryDate') else None
        multi_unit = dictionary.get('multiUnit')
        parent_id = dictionary.get('parentId')

        # Return an object of this model
        return cls(name,
                   rooms,
                   bathrooms,
                   persons,
                   property_type,
                   currency,
                   supported_los_rates,
                   id,
                   alt_id,
                   supplier_id,
                   toilets,
                   total_beds,
                   space,
                   space_unit,
                   childs,
                   latitude,
                   longitude,
                   living_room,
                   notes,
                   attributes_with_quantity,
                   nearby_amenities,
                   bedroom_configuration,
                   check_in_time,
                   check_in_to_time,
                   check_out_time,
                   policy,
                   location,
                   tax_number,
                   tourist_license_number,
                   tourist_license_expiry_date,
                   multi_unit,
                   parent_id)


