# coding: utf-8


"""
IGNORE:
    Nutanix Networking APIs

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

    OpenAPI spec version: 4.3.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.IPAddressOrFQDN import IPAddressOrFQDN  # noqa: F401,E501
from ntnx_networking_py_client.models.networking.v4.config.GatewayInterface import GatewayInterface  # noqa: F401,E501
from ntnx_networking_py_client.models.networking.v4.config.GatewayManagementInterface import GatewayManagementInterface  # noqa: F401,E501

class GatewayDeployment(object):

    """Network gateway deployment configuration.

    :param cluster_reference: (:attr:`cluster_reference`) Cluster reference required to identify which on-prem cluster to deploy the gateway VM on. 
    :type cluster_reference: 
    
    
    :param management_interface: (:attr:`management_interface`) 
    :type management_interface: 
    
    
    :param interfaces: (:attr:`interfaces`) List of network interfaces for this gateway.
    :type interfaces: 
    
    
    :param vcenter_datastore_name: (:attr:`vcenter_datastore_name`) vCenter datastore to which the gateway disks and images will be uploaded during deployment. 
    :type vcenter_datastore_name: 
     max=128 chars
    
    :param should_synchronize_system_ntp_servers: (:attr:`should_synchronize_system_ntp_servers`) Boolean flag indicating which NTP servers are configured on the gateway. When True, the gateway will use the same NTP servers configured on the PC. When False, the gateway will use the list of NTP servers specified by ntpServers.  (**Default** False)
    :type should_synchronize_system_ntp_servers: 
    
    
    :param ntp_servers: (:attr:`ntp_servers`) List of NTP servers configured on the gateway.  When shouldSynchronizeSystemNtpServers is True this key may be omitted. Any valid list value given for this key will be ignored.  When shouldSynchronizeSystemNtpServers is False this field may be provided. If an empty list value is given, or if this key is omitted, the following NTP servers will be used by default:    time.google.com    0.pool.ntp.org    1.pool.ntp.org    2.pool.ntp.org    3.pool.ntp.org  When an NTP server is provided as an IP address, the prefixLength property of each IP address will always have a value of 32. 
    :type ntp_servers: 
    
    
    :param should_synchronize_system_dns_servers: (:attr:`should_synchronize_system_dns_servers`) Boolean flag indicating which DNS servers are configured on the gateway. When True, the gateway will use the same DNS servers configured on the PC. When False, the gateway will use the list of DNS servers specified by dnsServers.  (**Default** False)
    :type should_synchronize_system_dns_servers: 
    
    
    :param dns_servers: (:attr:`dns_servers`) List of DNS servers configured on the gateway.  When shouldSynchronizeSystemDnsServers is True this key may be omitted. Any valid list value given for this key will be ignored.  When shouldSynchronizeSystemDnsServers is False this field may be provided. If an empty list value is given, or if this key is omitted, the following DNS servers will be used by default:    8.8.8.8    4.4.4.4  The prefixLength property of each IP address will always have a value of 32. 
    :type dns_servers: 
    
    

    """
    """
    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 = {
        'cluster_reference': 'str',
        'management_interface': 'networking.v4.config.GatewayManagementInterface',
        'interfaces': 'list[networking.v4.config.GatewayInterface]',
        'vcenter_datastore_name': 'str',
        'should_synchronize_system_ntp_servers': 'bool',
        'ntp_servers': 'list[common.v1.config.IPAddressOrFQDN]',
        'should_synchronize_system_dns_servers': 'bool',
        'dns_servers': 'list[common.v1.config.IPAddress]',
        '_reserved': 'dict(str, object)',
        '_object_type': 'str',
        '_unknown_fields': 'dict(str, object)',
    }

    attribute_map = {
        'cluster_reference': 'clusterReference',
        'management_interface': 'managementInterface',
        'interfaces': 'interfaces',
        'vcenter_datastore_name': 'vcenterDatastoreName',
        'should_synchronize_system_ntp_servers': 'shouldSynchronizeSystemNtpServers',
        'ntp_servers': 'ntpServers',
        'should_synchronize_system_dns_servers': 'shouldSynchronizeSystemDnsServers',
        'dns_servers': 'dnsServers',
        '_reserved': '$reserved',
        '_object_type': '$objectType',
        '_unknown_fields': '$unknownFields',
    }



    def __init__(self, cluster_reference=None, management_interface=None, interfaces=None, vcenter_datastore_name=None, should_synchronize_system_ntp_servers=False, ntp_servers=None, should_synchronize_system_dns_servers=False, dns_servers=None, *args, **kwargs):  # noqa: E501
        self.__cluster_reference = None
        self.__management_interface = None
        self.__interfaces = None
        self.__vcenter_datastore_name = None
        self.__should_synchronize_system_ntp_servers = None
        self.__ntp_servers = None
        self.__should_synchronize_system_dns_servers = None
        self.__dns_servers = None
        self.discriminator = None
        if cluster_reference is not None:
            self.__cluster_reference = cluster_reference
        if management_interface is not None:
            self.__management_interface = management_interface
        if interfaces is not None:
            self.__interfaces = interfaces
        if vcenter_datastore_name is not None:
            self.__vcenter_datastore_name = vcenter_datastore_name
        if should_synchronize_system_ntp_servers is not None:
            self.__should_synchronize_system_ntp_servers = should_synchronize_system_ntp_servers
        if ntp_servers is not None:
            self.__ntp_servers = ntp_servers
        if should_synchronize_system_dns_servers is not None:
            self.__should_synchronize_system_dns_servers = should_synchronize_system_dns_servers
        if dns_servers is not None:
            self.__dns_servers = dns_servers
        # populate hidden vars if not empty
        self._populate_hidden_vars(kwargs)

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

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

    def _populate_hidden_vars(self, kwargs):
        if "_reserved" in kwargs and kwargs["_reserved"] is not None:
            self.__dollar_reserved = kwargs["_reserved"]
        elif hasattr(self, "attribute_map") and "_reserved" in self.attribute_map and self.attribute_map["_reserved"] in kwargs and kwargs[self.attribute_map["_reserved"]] is not None:
            self.__dollar_reserved = kwargs[self.attribute_map["_reserved"]]
        else :
            self.__dollar_reserved = {"$fv": self._initialize_object_version()}
        if "_unknown_fields" in kwargs and kwargs["_unknown_fields"] is not None:
            self.__dollar_unknown_fields = kwargs["_unknown_fields"]
        elif hasattr(self, "attribute_map") and "_unknown_fields" in self.attribute_map and self.attribute_map["_unknown_fields"] in kwargs and kwargs[self.attribute_map["_unknown_fields"]] is not None:
            self.__dollar_unknown_fields = kwargs[self.attribute_map["_unknown_fields"]]
        else :
            self.__dollar_unknown_fields = {}
        if "_object_type" in kwargs and kwargs["_object_type"] is not None:
            self.__dollar_object_type = kwargs["_object_type"]
        elif hasattr(self, "attribute_map") and "_object_type" in self.attribute_map and self.attribute_map["_object_type"] in kwargs and kwargs[self.attribute_map["_object_type"]] is not None:
            self.__dollar_object_type = kwargs[self.attribute_map["_object_type"]]
        else:
            self.__dollar_object_type = self._initialize_object_type()

    def get_object_type(self):
        return self.__dollar_object_type

    def get_reserved(self):
        return self.__dollar_reserved

    def get_unknown_fields(self):
        return self.__dollar_unknown_fields

    @property
    def cluster_reference(self):
        """
        Cluster reference required to identify which on-prem cluster to deploy the gateway VM on. 

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

    @cluster_reference.setter
    def cluster_reference(self, cluster_reference):
        if cluster_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}$', cluster_reference):  # noqa: E501
            raise ValueError(r"Invalid value for `cluster_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.__cluster_reference = cluster_reference

    @property
    def management_interface(self):
        """
        

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

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

        self.__management_interface = management_interface

    @property
    def interfaces(self):
        """
        List of network interfaces for this gateway.

        :type:
             list[ :class:`~ntnx_networking_py_client.models.networking.v4.config.GatewayInterface` ]
        """  # noqa: E501
        return self.__interfaces

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

        self.__interfaces = interfaces

    @property
    def vcenter_datastore_name(self):
        """
        vCenter datastore to which the gateway disks and images will be uploaded during deployment. 

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

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

        self.__vcenter_datastore_name = vcenter_datastore_name

    @property
    def should_synchronize_system_ntp_servers(self):
        """
        Boolean flag indicating which NTP servers are configured on the gateway. When True, the gateway will use the same NTP servers configured on the PC. When False, the gateway will use the list of NTP servers specified by ntpServers. 

        :type:
                :class:`~bool`
        """  # noqa: E501
        return self.__should_synchronize_system_ntp_servers

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

        self.__should_synchronize_system_ntp_servers = should_synchronize_system_ntp_servers

    @property
    def ntp_servers(self):
        """
        List of NTP servers configured on the gateway.  When shouldSynchronizeSystemNtpServers is True this key may be omitted. Any valid list value given for this key will be ignored.  When shouldSynchronizeSystemNtpServers is False this field may be provided. If an empty list value is given, or if this key is omitted, the following NTP servers will be used by default:    time.google.com    0.pool.ntp.org    1.pool.ntp.org    2.pool.ntp.org    3.pool.ntp.org  When an NTP server is provided as an IP address, the prefixLength property of each IP address will always have a value of 32. 

        :type:
             list[ :class:`~ntnx_networking_py_client.models.common.v1.config.IPAddressOrFQDN` ]
        """  # noqa: E501
        return self.__ntp_servers

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

        self.__ntp_servers = ntp_servers

    @property
    def should_synchronize_system_dns_servers(self):
        """
        Boolean flag indicating which DNS servers are configured on the gateway. When True, the gateway will use the same DNS servers configured on the PC. When False, the gateway will use the list of DNS servers specified by dnsServers. 

        :type:
                :class:`~bool`
        """  # noqa: E501
        return self.__should_synchronize_system_dns_servers

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

        self.__should_synchronize_system_dns_servers = should_synchronize_system_dns_servers

    @property
    def dns_servers(self):
        """
        List of DNS servers configured on the gateway.  When shouldSynchronizeSystemDnsServers is True this key may be omitted. Any valid list value given for this key will be ignored.  When shouldSynchronizeSystemDnsServers is False this field may be provided. If an empty list value is given, or if this key is omitted, the following DNS servers will be used by default:    8.8.8.8    4.4.4.4  The prefixLength property of each IP address will always have a value of 32. 

        :type:
             list[ :class:`~ntnx_networking_py_client.models.common.v1.config.IPAddress` ]
        """  # noqa: E501
        return self.__dns_servers

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

        self.__dns_servers = dns_servers

    @property
    def _reserved(self):
        """
        

        :type:
            dict(str, :class:`~object`)
        """  # noqa: E501
        return self.__dollar_reserved

    @property
    def _object_type(self):
        """
        

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

    @property
    def _unknown_fields(self):
        """
        

        :type:
            dict(str, :class:`~object`)
        """  # noqa: E501
        return self.__dollar_unknown_fields

    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(GatewayDeployment, dict):
            for key, value in six.iteritems(self):
                result[key] = value

        # handle unknown fields
        result['_unknown_fields'] = {}
        unknown = self.get_unknown_fields()
        if sanitize:
            unknown = self._sanitize_for_serialization(unknown)

        return {**result, **unknown}

    def _sanitize_for_serialization(self, value):
        """Recursively sanitize the value for serialization.

        :param value: The value to sanitize
        :type value: any
        :return: Sanitized value
        :rtype: any
        """
        if isinstance(value, (list, tuple)):
            return list(map(self._sanitize_for_serialization, [v for v in value if v is not None]))
        elif isinstance(value, dict):
            return {k: self._sanitize_for_serialization(v) for k, v in six.iteritems(value) if v is not None}
        elif isinstance(value, (str, int, float, bool)):
            return value
        elif isinstance(value, Path):
            return str(value)
        else:
            return value.to_dict() if hasattr(value, 'to_dict') else str(value)

    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, GatewayDeployment):
            return False

        return self.__dict__ == other.__dict__

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

