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

"""
    test_meraki

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

import test_meraki.models.traffic_shaping_rule
import test_meraki.models.l_3_firewall_rule
import test_meraki.models.l_7_firewall_rule

class FirewallAndTrafficShaping(object):

    """Implementation of the 'FirewallAndTrafficShaping' model.

    The firewall and traffic shaping rules and settings for your policy.

    Attributes:
        settings (Settings1Enum): How firewall and traffic shaping rules are
            enforced. Can be 'network default', 'ignore' or 'custom'.
        traffic_shaping_rules (list of TrafficShapingRule): An array of
            traffic shaping rules. Rules are applied in the order that    
            they are specified in. An empty list (or null) means no rules.
            Note that     you are allowed a maximum of 8 rules.
        l_3_firewall_rules (list of L3FirewallRule): An ordered array of the
            L3 firewall rules
        l_7_firewall_rules (list of L7FirewallRule): An ordered array of L7
            firewall rules

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "settings":'settings',
        "traffic_shaping_rules":'trafficShapingRules',
        "l_3_firewall_rules":'l3FirewallRules',
        "l_7_firewall_rules":'l7FirewallRules'
    }

    def __init__(self,
                 settings=None,
                 traffic_shaping_rules=None,
                 l_3_firewall_rules=None,
                 l_7_firewall_rules=None):
        """Constructor for the FirewallAndTrafficShaping class"""

        # Initialize members of the class
        self.settings = settings
        self.traffic_shaping_rules = traffic_shaping_rules
        self.l_3_firewall_rules = l_3_firewall_rules
        self.l_7_firewall_rules = l_7_firewall_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')
        traffic_shaping_rules = None
        if dictionary.get('trafficShapingRules') != None:
            traffic_shaping_rules = list()
            for structure in dictionary.get('trafficShapingRules'):
                traffic_shaping_rules.append(test_meraki.models.traffic_shaping_rule.TrafficShapingRule.from_dictionary(structure))
        l_3_firewall_rules = None
        if dictionary.get('l3FirewallRules') != None:
            l_3_firewall_rules = list()
            for structure in dictionary.get('l3FirewallRules'):
                l_3_firewall_rules.append(test_meraki.models.l_3_firewall_rule.L3FirewallRule.from_dictionary(structure))
        l_7_firewall_rules = None
        if dictionary.get('l7FirewallRules') != None:
            l_7_firewall_rules = list()
            for structure in dictionary.get('l7FirewallRules'):
                l_7_firewall_rules.append(test_meraki.models.l_7_firewall_rule.L7FirewallRule.from_dictionary(structure))

        # Return an object of this model
        return cls(settings,
                   traffic_shaping_rules,
                   l_3_firewall_rules,
                   l_7_firewall_rules)


