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

"""
    apimaticcalculatorlatest

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

import apimaticcalculatorlatest.models.internet_policy
import apimaticcalculatorlatest.models.parking_policy
import apimaticcalculatorlatest.models.pet_policy

class Policy(object):

    """Implementation of the 'Policy' model.

    TODO: type model description here.

    Attributes:
        internet_policy (InternetPolicy): TODO: type description here.
        parking_policy (ParkingPolicy): TODO: type description here.
        pet_policy (PetPolicy): TODO: type description here.
        children_allowed (bool): Children policy
        smoking_allowed (bool): Smoking policy

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "children_allowed":'childrenAllowed',
        "smoking_allowed":'smokingAllowed',
        "internet_policy":'internetPolicy',
        "parking_policy":'parkingPolicy',
        "pet_policy":'petPolicy'
    }

    def __init__(self,
                 children_allowed=None,
                 smoking_allowed=None,
                 internet_policy=None,
                 parking_policy=None,
                 pet_policy=None):
        """Constructor for the Policy class"""

        # Initialize members of the class
        self.internet_policy = internet_policy
        self.parking_policy = parking_policy
        self.pet_policy = pet_policy
        self.children_allowed = children_allowed
        self.smoking_allowed = smoking_allowed


    @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
        children_allowed = dictionary.get('childrenAllowed')
        smoking_allowed = dictionary.get('smokingAllowed')
        internet_policy = apimaticcalculatorlatest.models.internet_policy.InternetPolicy.from_dictionary(dictionary.get('internetPolicy')) if dictionary.get('internetPolicy') else None
        parking_policy = apimaticcalculatorlatest.models.parking_policy.ParkingPolicy.from_dictionary(dictionary.get('parkingPolicy')) if dictionary.get('parkingPolicy') else None
        pet_policy = apimaticcalculatorlatest.models.pet_policy.PetPolicy.from_dictionary(dictionary.get('petPolicy')) if dictionary.get('petPolicy') else None

        # Return an object of this model
        return cls(children_allowed,
                   smoking_allowed,
                   internet_policy,
                   parking_policy,
                   pet_policy)


