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

"""
    test_meraki

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

import test_meraki.models.rule_1

class BonjourForwarding(object):

    """Implementation of the 'BonjourForwarding' model.

    The Bonjour settings for your group policy. Only valid if your network has
    a wireless configuration.

    Attributes:
        settings (Settings6Enum): How Bonjour rules are applied. Can be
            'network default', 'ignore' or 'custom'.
        rules (list of Rule1): A list of the Bonjour forwarding rules for your
            group policy. If 'settings' is set to 'custom', at least one rule
            must be specified.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "settings":'settings',
        "rules":'rules'
    }

    def __init__(self,
                 settings=None,
                 rules=None):
        """Constructor for the BonjourForwarding class"""

        # Initialize members of the class
        self.settings = settings
        self.rules = rules


    @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
        settings = dictionary.get('settings')
        rules = None
        if dictionary.get('rules') != None:
            rules = list()
            for structure in dictionary.get('rules'):
                rules.append(test_meraki.models.rule_1.Rule1.from_dictionary(structure))

        # Return an object of this model
        return cls(settings,
                   rules)


