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

"""
    test_meraki

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

import test_meraki.models.ipsec_policies

class Peer(object):

    """Implementation of the 'Peer' model.

    TODO: type model description here.

    Attributes:
        name (string): The name of the VPN peer
        public_ip (string): The public IP of the VPN peer
        remote_id (string): [optional] The remote ID is used to identify the
            connecting VPN peer. This can either be a valid IPv4 Address, FQDN
            or User FQDN.
        private_subnets (list of string): The list of the private subnets of
            the VPN peer
        ipsec_policies (IpsecPolicies): Custom IPSec policies for the VPN
            peer. If not included and a preset has not been chosen, the
            default preset for IPSec policies will be used.
        ipsec_policies_preset (string): One of the following available
            presets: 'default', 'aws', 'azure'. If this is provided, the
            'ipsecPolicies' parameter is ignored.
        secret (string): The shared secret with the VPN peer
        network_tags (list of string): A list of network tags that will
            connect with this peer. Use ['all'] for all networks. Use ['none']
            for no networks. If not included, the default is ['all'].

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "name":'name',
        "public_ip":'publicIp',
        "private_subnets":'privateSubnets',
        "secret":'secret',
        "remote_id":'remoteId',
        "ipsec_policies":'ipsecPolicies',
        "ipsec_policies_preset":'ipsecPoliciesPreset',
        "network_tags":'networkTags'
    }

    def __init__(self,
                 name=None,
                 public_ip=None,
                 private_subnets=None,
                 secret=None,
                 remote_id=None,
                 ipsec_policies=None,
                 ipsec_policies_preset=None,
                 network_tags=None):
        """Constructor for the Peer class"""

        # Initialize members of the class
        self.name = name
        self.public_ip = public_ip
        self.remote_id = remote_id
        self.private_subnets = private_subnets
        self.ipsec_policies = ipsec_policies
        self.ipsec_policies_preset = ipsec_policies_preset
        self.secret = secret
        self.network_tags = network_tags


    @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')
        public_ip = dictionary.get('publicIp')
        private_subnets = dictionary.get('privateSubnets')
        secret = dictionary.get('secret')
        remote_id = dictionary.get('remoteId')
        ipsec_policies = test_meraki.models.ipsec_policies.IpsecPolicies.from_dictionary(dictionary.get('ipsecPolicies')) if dictionary.get('ipsecPolicies') else None
        ipsec_policies_preset = dictionary.get('ipsecPoliciesPreset')
        network_tags = dictionary.get('networkTags')

        # Return an object of this model
        return cls(name,
                   public_ip,
                   private_subnets,
                   secret,
                   remote_id,
                   ipsec_policies,
                   ipsec_policies_preset,
                   network_tags)


