# coding: utf-8


"""
IGNORE:
    Nutanix Networking APIs

    Manage networking configuration on Nutanix clusters, including AHV and advanced networking.  # noqa: E501

    OpenAPI spec version: 4.0.1
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
IGNORE
"""
import pprint
import json
import ast
import re  # noqa: F401

import six
from pathlib import Path
from ntnx_networking_py_client.models.common.v1.config.IPAddress import IPAddress  # noqa: F401,E501
from ntnx_networking_py_client.models.common.v1.config.Metadata import Metadata  # noqa: F401,E501
from ntnx_networking_py_client.models.networking.v4.config.Gateway import Gateway  # noqa: F401,E501
from ntnx_networking_py_client.models.networking.v4.config.NetworkingBaseModel import NetworkingBaseModel  # noqa: F401,E501
from ntnx_networking_py_client.models.networking.v4.config.Status import Status  # noqa: F401,E501

class BgpSession(NetworkingBaseModel):

    """BGP session.

    :param name: (:attr:`name`) BGP session name.
    :type name: required
     max=128 chars
    
    :param description: (:attr:`description`) BGP session description.
    :type description: 
     max=1000 chars
    
    :param local_gateway_reference: (:attr:`local_gateway_reference`) Local BGP gateway reference.
    :type local_gateway_reference: required
    
    
    :param remote_gateway_reference: (:attr:`remote_gateway_reference`) Remote BGP gateway reference.
    :type remote_gateway_reference: required
    
    
    :param local_gateway_interface_ip_address: (:attr:`local_gateway_interface_ip_address`) 
    :type local_gateway_interface_ip_address: 
    
    
    :param dynamic_route_priority: (:attr:`dynamic_route_priority`) Priority assigned to routes received over this BGP session.
    :type dynamic_route_priority: 
    
     min=300, max=1000
    :param password: (:attr:`password`) BGP password
    :type password: 
    
    
    :param status: (:attr:`status`) 
    :type status: 
    
    
    :param local_gateway: (:attr:`local_gateway`) 
    :type local_gateway: 
    
    
    :param remote_gateway: (:attr:`remote_gateway`) 
    :type remote_gateway: 
    
    

    """
    """
    IGNORE:
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    IGNORE
    """  # noqa: E501
    swagger_types = {
        'name': 'str',
        'description': 'str',
        'local_gateway_reference': 'str',
        'remote_gateway_reference': 'str',
        'local_gateway_interface_ip_address': 'common.v1.config.IPAddress',
        'dynamic_route_priority': 'int',
        'password': 'str',
        'status': 'networking.v4.config.Status',
        'local_gateway': 'networking.v4.config.Gateway',
        'remote_gateway': 'networking.v4.config.Gateway',
        'metadata': 'common.v1.config.Metadata',
        'ext_id': 'str',
        'links': 'list[common.v1.response.ApiLink]',
        'tenant_id': 'str',
        '_reserved': 'dict(str, object)',
        '_object_type': 'str',
        '_unknown_fields': 'dict(str, object)',
    }

    attribute_map = {
        'name': 'name',
        'description': 'description',
        'local_gateway_reference': 'localGatewayReference',
        'remote_gateway_reference': 'remoteGatewayReference',
        'local_gateway_interface_ip_address': 'localGatewayInterfaceIpAddress',
        'dynamic_route_priority': 'dynamicRoutePriority',
        'password': 'password',
        'status': 'status',
        'local_gateway': 'localGateway',
        'remote_gateway': 'remoteGateway',
        'metadata': 'metadata',
        'ext_id': 'extId',
        'links': 'links',
        'tenant_id': 'tenantId',
        '_reserved': '$reserved',
        '_object_type': '$objectType',
        '_unknown_fields': '$unknownFields',
    }



    def __init__(self, name=None, description=None, local_gateway_reference=None, remote_gateway_reference=None, local_gateway_interface_ip_address=None, dynamic_route_priority=None, password=None, status=None, local_gateway=None, remote_gateway=None, metadata=None, ext_id=None, links=None, tenant_id=None, *args, **kwargs):  # noqa: E501
        NetworkingBaseModel.__init__(self, metadata, ext_id, links, tenant_id, *args, **kwargs)
        self.__name = None
        self.__description = None
        self.__local_gateway_reference = None
        self.__remote_gateway_reference = None
        self.__local_gateway_interface_ip_address = None
        self.__dynamic_route_priority = None
        self.__password = None
        self.__status = None
        self.__local_gateway = None
        self.__remote_gateway = None
        self.discriminator = None
        self.__name = name
        if description is not None:
            self.__description = description
        self.__local_gateway_reference = local_gateway_reference
        self.__remote_gateway_reference = remote_gateway_reference
        if local_gateway_interface_ip_address is not None:
            self.__local_gateway_interface_ip_address = local_gateway_interface_ip_address
        if dynamic_route_priority is not None:
            self.__dynamic_route_priority = dynamic_route_priority
        if password is not None:
            self.__password = password
        if status is not None:
            self.__status = status
        if local_gateway is not None:
            self.__local_gateway = local_gateway
        if remote_gateway is not None:
            self.__remote_gateway = remote_gateway

    def _initialize_object_type(self):
        return 'networking.v4.config.BgpSession'

    def _initialize_object_version(self):
        return 'v4.r0'


    @property
    def name(self):
        """
        BGP session name.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__name

    @name.setter
    def name(self, name):
        if name is None:
            raise ValueError("Invalid value for `name`, must not be `None`")  # noqa: E501
        if name is not None and len(name) > 128:
            raise ValueError("Invalid value for `name`, length must be less than or equal to `128`")  # noqa: E501

        self.__name = name

    @property
    def description(self):
        """
        BGP session description.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__description

    @description.setter
    def description(self, description):
        if description is not None and len(description) > 1000:
            raise ValueError("Invalid value for `description`, length must be less than or equal to `1000`")  # noqa: E501

        self.__description = description

    @property
    def local_gateway_reference(self):
        """
        Local BGP gateway reference.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__local_gateway_reference

    @local_gateway_reference.setter
    def local_gateway_reference(self, local_gateway_reference):
        if local_gateway_reference is None:
            raise ValueError("Invalid value for `local_gateway_reference`, must not be `None`")  # noqa: E501
        if local_gateway_reference is not None and not re.search('^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$', local_gateway_reference):  # noqa: E501
            raise ValueError(r"Invalid value for `local_gateway_reference`, must be a follow pattern or equal to `/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/`")  # noqa: E501

        self.__local_gateway_reference = local_gateway_reference

    @property
    def remote_gateway_reference(self):
        """
        Remote BGP gateway reference.

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__remote_gateway_reference

    @remote_gateway_reference.setter
    def remote_gateway_reference(self, remote_gateway_reference):
        if remote_gateway_reference is None:
            raise ValueError("Invalid value for `remote_gateway_reference`, must not be `None`")  # noqa: E501
        if remote_gateway_reference is not None and not re.search('^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$', remote_gateway_reference):  # noqa: E501
            raise ValueError(r"Invalid value for `remote_gateway_reference`, must be a follow pattern or equal to `/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/`")  # noqa: E501

        self.__remote_gateway_reference = remote_gateway_reference

    @property
    def local_gateway_interface_ip_address(self):
        """
        

        :type:
            :class:`~ntnx_networking_py_client.models.common.v1.config.IPAddress`
        """  # noqa: E501
        return self.__local_gateway_interface_ip_address

    @local_gateway_interface_ip_address.setter
    def local_gateway_interface_ip_address(self, local_gateway_interface_ip_address):

        self.__local_gateway_interface_ip_address = local_gateway_interface_ip_address

    @property
    def dynamic_route_priority(self):
        """
        Priority assigned to routes received over this BGP session.

        :type:
                :class:`~int`
        """  # noqa: E501
        return self.__dynamic_route_priority

    @dynamic_route_priority.setter
    def dynamic_route_priority(self, dynamic_route_priority):
        if dynamic_route_priority is not None and dynamic_route_priority > 1000:  # noqa: E501
            raise ValueError("Invalid value for `dynamic_route_priority`, must be a value less than or equal to `1000`")  # noqa: E501
        if dynamic_route_priority is not None and dynamic_route_priority < 300:  # noqa: E501
            raise ValueError("Invalid value for `dynamic_route_priority`, must be a value greater than or equal to `300`")  # noqa: E501

        self.__dynamic_route_priority = dynamic_route_priority

    @property
    def password(self):
        """
        BGP password

        :type:
                :class:`~str`
        """  # noqa: E501
        return self.__password

    @password.setter
    def password(self, password):

        self.__password = password

    @property
    def status(self):
        """
        

        :type:
            :class:`~ntnx_networking_py_client.models.networking.v4.config.Status`
        """  # noqa: E501
        return self.__status

    @status.setter
    def status(self, status):

        self.__status = status

    @property
    def local_gateway(self):
        """
        

        :type:
            :class:`~ntnx_networking_py_client.models.networking.v4.config.Gateway`
        """  # noqa: E501
        return self.__local_gateway

    @local_gateway.setter
    def local_gateway(self, local_gateway):

        self.__local_gateway = local_gateway

    @property
    def remote_gateway(self):
        """
        

        :type:
            :class:`~ntnx_networking_py_client.models.networking.v4.config.Gateway`
        """  # noqa: E501
        return self.__remote_gateway

    @remote_gateway.setter
    def remote_gateway(self, remote_gateway):

        self.__remote_gateway = remote_gateway

    def _to_dict(self, sanitize):
        """Returns the model properties as a dict. Omits None properties based on the provided "sanitize" parameter.

        :param sanitize: A flag to omit None properties if set to True
        :type sanitize: bool
        """

        result = {}
        for attr, attr_type in six.iteritems(self.swagger_types):

            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x._to_dict(sanitize) if hasattr(x, "_to_dict") else x,
                    value
                ))
            elif hasattr(value, "_to_dict"):
                result[attr] = value._to_dict(sanitize)
            elif isinstance(value, Path):
                result[attr] = str(value)
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1]._to_dict(sanitize)) if hasattr(item[1], "_to_dict")
                    else (
                        (item[0], str(item[1])) if item[0] == 'path' and '$objectType' in value and value['$objectType'] == 'pathlib.Path'
                        else item
                    ),
                    six.iteritems(value)
                ))
            else:
                if sanitize:
                    if value is not None:
                        result[attr] = value
                else:
                    result[attr] = value
        if issubclass(BgpSession, dict):
            for key, value in six.iteritems(self):
                result[key] = value

        return result

    def to_dict(self):
        """Returns the model properties as a dictionary"""
        return self._to_dict(False)

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self._to_dict(True))

    def __repr__(self):
        """For `print` and `pprint`"""
        return self.to_str()

    def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, BgpSession):
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        return not self == other

