"""
    Delphix DCT API

    Delphix DCT API  # noqa: E501

    The version of the OpenAPI document: 3.24.0
    Contact: support@delphix.com
    Generated by: https://openapi-generator.tech
"""


import re  # noqa: F401
import sys  # noqa: F401

from delphix.api.gateway.model_utils import (  # noqa: F401
    ApiTypeError,
    ModelComposed,
    ModelNormal,
    ModelSimple,
    cached_property,
    change_keys_js_to_python,
    convert_js_args_to_python_args,
    date,
    datetime,
    file_type,
    none_type,
    validate_get_composed_info,
)
from ..model_utils import OpenApiModel
from delphix.api.gateway.exceptions import ApiAttributeError


def lazy_import():
    from delphix.api.gateway.model.environment_repository_all_of import EnvironmentRepositoryAllOf
    from delphix.api.gateway.model.mssql_cluster_listener import MSSQLClusterListener
    from delphix.api.gateway.model.repository import Repository
    globals()['EnvironmentRepositoryAllOf'] = EnvironmentRepositoryAllOf
    globals()['MSSQLClusterListener'] = MSSQLClusterListener
    globals()['Repository'] = Repository


class EnvironmentRepository(ModelComposed):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.

    Attributes:
      allowed_values (dict): The key is the tuple path to the attribute
          and the for var_name this is (var_name,). The value is a dict
          with a capitalized key describing the allowed value and an allowed
          value. These dicts store the allowed enum values.
      attribute_map (dict): The key is attribute name
          and the value is json key in definition.
      discriminator_value_class_map (dict): A dict to go from the discriminator
          variable value to the discriminator class name.
      validations (dict): The key is the tuple path to the attribute
          and the for var_name this is (var_name,). The value is a dict
          that stores validations for max_length, min_length, max_items,
          min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
          inclusive_minimum, and regex.
      additional_properties_type (tuple): A tuple of classes accepted
          as additional properties values.
    """

    allowed_values = {
    }

    validations = {
    }

    @cached_property
    def additional_properties_type():
        """
        This must be a method because a model may have properties that are
        of type self, this must run after the class is loaded
        """
        lazy_import()
        return (bool, date, datetime, dict, float, int, list, str, none_type,)  # noqa: E501

    _nullable = False

    @cached_property
    def openapi_types():
        """
        This must be a method because a model may have properties that are
        of type self, this must run after the class is loaded

        Returns
            openapi_types (dict): The key is attribute name
                and the value is attribute type.
        """
        lazy_import()
        return {
            'id': (str,),  # noqa: E501
            'name': (str,),  # noqa: E501
            'database_type': (str,),  # noqa: E501
            'allow_provisioning': (bool,),  # noqa: E501
            'is_staging': (bool,),  # noqa: E501
            'oracle_base': (str,),  # noqa: E501
            'version': (str,),  # noqa: E501
            'bits': (int,),  # noqa: E501
            'install_group': (str,),  # noqa: E501
            'install_user': (str,),  # noqa: E501
            'rac': (bool,),  # noqa: E501
            'ports': ([int],),  # noqa: E501
            'port': (int,),  # noqa: E501
            'dump_history_file': (str,),  # noqa: E501
            'page_size': (int,),  # noqa: E501
            'owner': (str,),  # noqa: E501
            'installation_path': (str,),  # noqa: E501
            'fulltext_installed': (bool,),  # noqa: E501
            'internal_version': (int,),  # noqa: E501
            'mssql_cluster_instances_name': ([str],),  # noqa: E501
            'mssql_cluster_instances_version': ([str],),  # noqa: E501
            'mssql_cluster_instances_owners': ([str],),  # noqa: E501
            'mssql_cluster_instances_ports': ([int],),  # noqa: E501
            'mssql_cluster_instances_server_names': ([str],),  # noqa: E501
            'mssql_cluster_instances_nodes': ([str],),  # noqa: E501
            'installation_home': (str,),  # noqa: E501
            'drive_letter': ([str],),  # noqa: E501
            'discovered': (bool,),  # noqa: E501
            'mssql_listeners': ([MSSQLClusterListener],),  # noqa: E501
            'database_username': (str,),  # noqa: E501
            'service_principal_name': (str,),  # noqa: E501
            'isql_path': (str,),  # noqa: E501
            'ase_tls_enabled': (bool,),  # noqa: E501
            'environment_id': (str,),  # noqa: E501
        }

    @cached_property
    def discriminator():
        return None


    attribute_map = {
        'id': 'id',  # noqa: E501
        'name': 'name',  # noqa: E501
        'database_type': 'database_type',  # noqa: E501
        'allow_provisioning': 'allow_provisioning',  # noqa: E501
        'is_staging': 'is_staging',  # noqa: E501
        'oracle_base': 'oracle_base',  # noqa: E501
        'version': 'version',  # noqa: E501
        'bits': 'bits',  # noqa: E501
        'install_group': 'install_group',  # noqa: E501
        'install_user': 'install_user',  # noqa: E501
        'rac': 'rac',  # noqa: E501
        'ports': 'ports',  # noqa: E501
        'port': 'port',  # noqa: E501
        'dump_history_file': 'dump_history_file',  # noqa: E501
        'page_size': 'page_size',  # noqa: E501
        'owner': 'owner',  # noqa: E501
        'installation_path': 'installation_path',  # noqa: E501
        'fulltext_installed': 'fulltext_installed',  # noqa: E501
        'internal_version': 'internal_version',  # noqa: E501
        'mssql_cluster_instances_name': 'mssql_cluster_instances_name',  # noqa: E501
        'mssql_cluster_instances_version': 'mssql_cluster_instances_version',  # noqa: E501
        'mssql_cluster_instances_owners': 'mssql_cluster_instances_owners',  # noqa: E501
        'mssql_cluster_instances_ports': 'mssql_cluster_instances_ports',  # noqa: E501
        'mssql_cluster_instances_server_names': 'mssql_cluster_instances_server_names',  # noqa: E501
        'mssql_cluster_instances_nodes': 'mssql_cluster_instances_nodes',  # noqa: E501
        'installation_home': 'installation_home',  # noqa: E501
        'drive_letter': 'drive_letter',  # noqa: E501
        'discovered': 'discovered',  # noqa: E501
        'mssql_listeners': 'mssql_listeners',  # noqa: E501
        'database_username': 'database_username',  # noqa: E501
        'service_principal_name': 'service_principal_name',  # noqa: E501
        'isql_path': 'isql_path',  # noqa: E501
        'ase_tls_enabled': 'ase_tls_enabled',  # noqa: E501
        'environment_id': 'environment_id',  # noqa: E501
    }

    read_only_vars = {
        'discovered',  # noqa: E501
    }

    @classmethod
    @convert_js_args_to_python_args
    def _from_openapi_data(cls, *args, **kwargs):  # noqa: E501
        """EnvironmentRepository - a model defined in OpenAPI

        Keyword Args:
            _check_type (bool): if True, values for parameters in openapi_types
                                will be type checked and a TypeError will be
                                raised if the wrong type is input.
                                Defaults to True
            _path_to_item (tuple/list): This is a list of keys or values to
                                drill down to the model in received_data
                                when deserializing a response
            _spec_property_naming (bool): True if the variable names in the input data
                                are serialized names, as specified in the OpenAPI document.
                                False if the variable names in the input data
                                are pythonic names, e.g. snake case (default)
            _configuration (Configuration): the instance to use when
                                deserializing a file_type parameter.
                                If passed, type conversion is attempted
                                If omitted no type conversion is done.
            _visited_composed_classes (tuple): This stores a tuple of
                                classes that we have traveled through so that
                                if we see that class again we will not use its
                                discriminator again.
                                When traveling through a discriminator, the
                                composed schema that is
                                is traveled through is added to this set.
                                For example if Animal has a discriminator
                                petType and we pass in "Dog", and the class Dog
                                allOf includes Animal, we move through Animal
                                once using the discriminator, and pick Dog.
                                Then in Dog, we will make an instance of the
                                Animal class but this time we won't travel
                                through its discriminator because we passed in
                                _visited_composed_classes = (Animal,)
            id (str): Entity id of the repository.. [optional]  # noqa: E501
            name (str): Name of the repository.. [optional]  # noqa: E501
            database_type (str): The database type of this repository.. [optional]  # noqa: E501
            allow_provisioning (bool): Flag indicating whether the repository should be used for provisioning.. [optional]  # noqa: E501
            is_staging (bool): Flag indicating whether this repository can be used by the Delphix Engine for internal processing.. [optional]  # noqa: E501
            oracle_base (str): The Oracle base where database binaries are located.. [optional]  # noqa: E501
            version (str): Version of the repository.. [optional]  # noqa: E501
            bits (int): 32 or 64 bits.. [optional]  # noqa: E501
            install_group (str): Group name of the user that owns the install.. [optional]  # noqa: E501
            install_user (str): User name of the user that owns the install.. [optional]  # noqa: E501
            rac (bool): Flag indicating whether the install supports Oracle RAC.. [optional]  # noqa: E501
            ports ([int]): The network ports for connecting to the database instance.. [optional]  # noqa: E501
            port (int): The network port for connecting to the SQL Server instance.. [optional]  # noqa: E501
            dump_history_file (str): Fully qualified name of the dump history file.. [optional]  # noqa: E501
            page_size (int): Database page size for the SAP ASE instance.. [optional]  # noqa: E501
            owner (str): Account the database server instance is running as.. [optional]  # noqa: E501
            installation_path (str): Directory path where the installation is located.. [optional]  # noqa: E501
            fulltext_installed (bool): This property determines if the full-text search and semantic search is installed or not.. [optional]  # noqa: E501
            internal_version (int): The internal version is tied to the data format of a database and is used to detect compatibility.. [optional]  # noqa: E501
            mssql_cluster_instances_name ([str]): MSSQL cluster instances name.. [optional]  # noqa: E501
            mssql_cluster_instances_version ([str]): MSSQL cluster instances version.. [optional]  # noqa: E501
            mssql_cluster_instances_owners ([str]): MSSQL cluster instance owners.. [optional]  # noqa: E501
            mssql_cluster_instances_ports ([int]): MSSQL cluster instances ports.. [optional]  # noqa: E501
            mssql_cluster_instances_server_names ([str]): MSSQL cluster instances server names.. [optional]  # noqa: E501
            mssql_cluster_instances_nodes ([str]): MSSQL cluster instances nodes.. [optional]  # noqa: E501
            installation_home (str): Directory where the installation home is located.. [optional]  # noqa: E501
            drive_letter ([str]): MSSQL failover cluster drive letter.. [optional]  # noqa: E501
            discovered (bool): Flag indicating whether the repository was automatically discovered.. [optional]  # noqa: E501
            mssql_listeners ([MSSQLClusterListener]): The list of listeners belonging to this repository.. [optional]  # noqa: E501
            database_username (str): The username of the ASE instance database.. [optional]  # noqa: E501
            service_principal_name (str): The Kerberos Service Principal Name (SPN) of the database.. [optional]  # noqa: E501
            isql_path (str): The path to the isql binary to use for this SAP ASE instance.. [optional]  # noqa: E501
            ase_tls_enabled (bool): True if SAP ASE instance is TLS/SSL enabled.. [optional]  # noqa: E501
            environment_id (str): The environment ID.. [optional]  # noqa: E501
        """

        _check_type = kwargs.pop('_check_type', True)
        _spec_property_naming = kwargs.pop('_spec_property_naming', False)
        _path_to_item = kwargs.pop('_path_to_item', ())
        _configuration = kwargs.pop('_configuration', None)
        _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

        self = super(OpenApiModel, cls).__new__(cls)

        if args:
            raise ApiTypeError(
                "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
                    args,
                    self.__class__.__name__,
                ),
                path_to_item=_path_to_item,
                valid_classes=(self.__class__,),
            )

        self._data_store = {}
        self._check_type = _check_type
        self._spec_property_naming = _spec_property_naming
        self._path_to_item = _path_to_item
        self._configuration = _configuration
        self._visited_composed_classes = _visited_composed_classes + (self.__class__,)

        constant_args = {
            '_check_type': _check_type,
            '_path_to_item': _path_to_item,
            '_spec_property_naming': _spec_property_naming,
            '_configuration': _configuration,
            '_visited_composed_classes': self._visited_composed_classes,
        }
        composed_info = validate_get_composed_info(
            constant_args, kwargs, self)
        self._composed_instances = composed_info[0]
        self._var_name_to_model_instances = composed_info[1]
        self._additional_properties_model_instances = composed_info[2]
        discarded_args = composed_info[3]

        for var_name, var_value in kwargs.items():
            if var_name in discarded_args and \
                        self._configuration is not None and \
                        self._configuration.discard_unknown_keys and \
                        self._additional_properties_model_instances:
                # discard variable.
                continue
            setattr(self, var_name, var_value)

        return self

    required_properties = set([
        '_data_store',
        '_check_type',
        '_spec_property_naming',
        '_path_to_item',
        '_configuration',
        '_visited_composed_classes',
        '_composed_instances',
        '_var_name_to_model_instances',
        '_additional_properties_model_instances',
    ])

    @convert_js_args_to_python_args
    def __init__(self, *args, **kwargs):  # noqa: E501
        """EnvironmentRepository - a model defined in OpenAPI

        Keyword Args:
            _check_type (bool): if True, values for parameters in openapi_types
                                will be type checked and a TypeError will be
                                raised if the wrong type is input.
                                Defaults to True
            _path_to_item (tuple/list): This is a list of keys or values to
                                drill down to the model in received_data
                                when deserializing a response
            _spec_property_naming (bool): True if the variable names in the input data
                                are serialized names, as specified in the OpenAPI document.
                                False if the variable names in the input data
                                are pythonic names, e.g. snake case (default)
            _configuration (Configuration): the instance to use when
                                deserializing a file_type parameter.
                                If passed, type conversion is attempted
                                If omitted no type conversion is done.
            _visited_composed_classes (tuple): This stores a tuple of
                                classes that we have traveled through so that
                                if we see that class again we will not use its
                                discriminator again.
                                When traveling through a discriminator, the
                                composed schema that is
                                is traveled through is added to this set.
                                For example if Animal has a discriminator
                                petType and we pass in "Dog", and the class Dog
                                allOf includes Animal, we move through Animal
                                once using the discriminator, and pick Dog.
                                Then in Dog, we will make an instance of the
                                Animal class but this time we won't travel
                                through its discriminator because we passed in
                                _visited_composed_classes = (Animal,)
            id (str): Entity id of the repository.. [optional]  # noqa: E501
            name (str): Name of the repository.. [optional]  # noqa: E501
            database_type (str): The database type of this repository.. [optional]  # noqa: E501
            allow_provisioning (bool): Flag indicating whether the repository should be used for provisioning.. [optional]  # noqa: E501
            is_staging (bool): Flag indicating whether this repository can be used by the Delphix Engine for internal processing.. [optional]  # noqa: E501
            oracle_base (str): The Oracle base where database binaries are located.. [optional]  # noqa: E501
            version (str): Version of the repository.. [optional]  # noqa: E501
            bits (int): 32 or 64 bits.. [optional]  # noqa: E501
            install_group (str): Group name of the user that owns the install.. [optional]  # noqa: E501
            install_user (str): User name of the user that owns the install.. [optional]  # noqa: E501
            rac (bool): Flag indicating whether the install supports Oracle RAC.. [optional]  # noqa: E501
            ports ([int]): The network ports for connecting to the database instance.. [optional]  # noqa: E501
            port (int): The network port for connecting to the SQL Server instance.. [optional]  # noqa: E501
            dump_history_file (str): Fully qualified name of the dump history file.. [optional]  # noqa: E501
            page_size (int): Database page size for the SAP ASE instance.. [optional]  # noqa: E501
            owner (str): Account the database server instance is running as.. [optional]  # noqa: E501
            installation_path (str): Directory path where the installation is located.. [optional]  # noqa: E501
            fulltext_installed (bool): This property determines if the full-text search and semantic search is installed or not.. [optional]  # noqa: E501
            internal_version (int): The internal version is tied to the data format of a database and is used to detect compatibility.. [optional]  # noqa: E501
            mssql_cluster_instances_name ([str]): MSSQL cluster instances name.. [optional]  # noqa: E501
            mssql_cluster_instances_version ([str]): MSSQL cluster instances version.. [optional]  # noqa: E501
            mssql_cluster_instances_owners ([str]): MSSQL cluster instance owners.. [optional]  # noqa: E501
            mssql_cluster_instances_ports ([int]): MSSQL cluster instances ports.. [optional]  # noqa: E501
            mssql_cluster_instances_server_names ([str]): MSSQL cluster instances server names.. [optional]  # noqa: E501
            mssql_cluster_instances_nodes ([str]): MSSQL cluster instances nodes.. [optional]  # noqa: E501
            installation_home (str): Directory where the installation home is located.. [optional]  # noqa: E501
            drive_letter ([str]): MSSQL failover cluster drive letter.. [optional]  # noqa: E501
            discovered (bool): Flag indicating whether the repository was automatically discovered.. [optional]  # noqa: E501
            mssql_listeners ([MSSQLClusterListener]): The list of listeners belonging to this repository.. [optional]  # noqa: E501
            database_username (str): The username of the ASE instance database.. [optional]  # noqa: E501
            service_principal_name (str): The Kerberos Service Principal Name (SPN) of the database.. [optional]  # noqa: E501
            isql_path (str): The path to the isql binary to use for this SAP ASE instance.. [optional]  # noqa: E501
            ase_tls_enabled (bool): True if SAP ASE instance is TLS/SSL enabled.. [optional]  # noqa: E501
            environment_id (str): The environment ID.. [optional]  # noqa: E501
        """

        _check_type = kwargs.pop('_check_type', True)
        _spec_property_naming = kwargs.pop('_spec_property_naming', False)
        _path_to_item = kwargs.pop('_path_to_item', ())
        _configuration = kwargs.pop('_configuration', None)
        _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

        if args:
            raise ApiTypeError(
                "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
                    args,
                    self.__class__.__name__,
                ),
                path_to_item=_path_to_item,
                valid_classes=(self.__class__,),
            )

        self._data_store = {}
        self._check_type = _check_type
        self._spec_property_naming = _spec_property_naming
        self._path_to_item = _path_to_item
        self._configuration = _configuration
        self._visited_composed_classes = _visited_composed_classes + (self.__class__,)

        constant_args = {
            '_check_type': _check_type,
            '_path_to_item': _path_to_item,
            '_spec_property_naming': _spec_property_naming,
            '_configuration': _configuration,
            '_visited_composed_classes': self._visited_composed_classes,
        }
        composed_info = validate_get_composed_info(
            constant_args, kwargs, self)
        self._composed_instances = composed_info[0]
        self._var_name_to_model_instances = composed_info[1]
        self._additional_properties_model_instances = composed_info[2]
        discarded_args = composed_info[3]

        for var_name, var_value in kwargs.items():
            if var_name in discarded_args and \
                        self._configuration is not None and \
                        self._configuration.discard_unknown_keys and \
                        self._additional_properties_model_instances:
                # discard variable.
                continue
            setattr(self, var_name, var_value)
            if var_name in self.read_only_vars:
                raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
                                     f"class with read only attributes.")

    @cached_property
    def _composed_schemas():
        # we need this here to make our import statements work
        # we must store _composed_schemas in here so the code is only run
        # when we invoke this method. If we kept this at the class
        # level we would get an error beause the class level
        # code would be run when this module is imported, and these composed
        # classes don't exist yet because their module has not finished
        # loading
        lazy_import()
        return {
          'anyOf': [
          ],
          'allOf': [
              EnvironmentRepositoryAllOf,
              Repository,
          ],
          'oneOf': [
          ],
        }
