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

"""
    test_meraki

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

import test_meraki.models.definition
import test_meraki.models.per_client_bandwidth_limits

class Rule9(object):

    """Implementation of the 'Rule9' model.

    TODO: type model description here.

    Attributes:
        definitions (list of Definition): A list of objects describing the
            definitions of your traffic shaping rule. At least one definition
            is required.
        per_client_bandwidth_limits (PerClientBandwidthLimits): An object
            describing the bandwidth settings for your rule.
        dscp_tag_value (int): The DSCP tag applied by your rule. null means
            'Do not change DSCP tag'.     For a list of possible tag values,
            use the trafficShaping/dscpTaggingOptions endpoint.
        pcp_tag_value (int): The PCP tag applied by your rule. Can be 0
            (lowest priority) through 7 (highest priority).     null means 'Do
            not set PCP tag'.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "definitions":'definitions',
        "per_client_bandwidth_limits":'perClientBandwidthLimits',
        "dscp_tag_value":'dscpTagValue',
        "pcp_tag_value":'pcpTagValue'
    }

    def __init__(self,
                 definitions=None,
                 per_client_bandwidth_limits=None,
                 dscp_tag_value=None,
                 pcp_tag_value=None):
        """Constructor for the Rule9 class"""

        # Initialize members of the class
        self.definitions = definitions
        self.per_client_bandwidth_limits = per_client_bandwidth_limits
        self.dscp_tag_value = dscp_tag_value
        self.pcp_tag_value = pcp_tag_value


    @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
        definitions = None
        if dictionary.get('definitions') != None:
            definitions = list()
            for structure in dictionary.get('definitions'):
                definitions.append(test_meraki.models.definition.Definition.from_dictionary(structure))
        per_client_bandwidth_limits = test_meraki.models.per_client_bandwidth_limits.PerClientBandwidthLimits.from_dictionary(dictionary.get('perClientBandwidthLimits')) if dictionary.get('perClientBandwidthLimits') else None
        dscp_tag_value = dictionary.get('dscpTagValue')
        pcp_tag_value = dictionary.get('pcpTagValue')

        # Return an object of this model
        return cls(definitions,
                   per_client_bandwidth_limits,
                   dscp_tag_value,
                   pcp_tag_value)


