"""
    Delphix DCT API

    Delphix DCT API  # noqa: E501

    The version of the OpenAPI document: 3.27.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.compliance_job_script import ComplianceJobScript
    from delphix.api.gateway.model.tag import Tag
    globals()['ComplianceJobScript'] = ComplianceJobScript
    globals()['Tag'] = Tag


class CreateComplianceJobRequest(ModelNormal):
    """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 = {
        ('type',): {
            'MASKING': "MASKING",
            'DISCOVERY': "DISCOVERY",
            'TOKENIZATION': "TOKENIZATION",
            'REIDENTIFICATION': "REIDENTIFICATION",
        },
    }

    validations = {
        ('max_memory',): {
            'inclusive_minimum': 0,
        },
        ('min_memory',): {
            'inclusive_minimum': 0,
        },
        ('feedback_size',): {
            'inclusive_minimum': 1,
        },
        ('stream_row_limit',): {
            'inclusive_minimum': -1,
        },
        ('num_input_streams',): {
            'inclusive_minimum': 1,
        },
        ('commit_size',): {
            'inclusive_minimum': 1,
        },
        ('num_output_threads_per_stream',): {
            'inclusive_minimum': 1,
        },
    }

    @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 {
            'name': (str,),  # noqa: E501
            'rule_set_id': (str,),  # noqa: E501
            'type': (str,),  # noqa: E501
            'description': (str,),  # noqa: E501
            'discovery_policy_id': (str,),  # noqa: E501
            'max_memory': (int,),  # noqa: E501
            'min_memory': (int,),  # noqa: E501
            'feedback_size': (int,),  # noqa: E501
            'stream_row_limit': (int,),  # noqa: E501
            'num_input_streams': (int,),  # noqa: E501
            'fail_immediately': (bool,),  # noqa: E501
            'batch_update': (bool,),  # noqa: E501
            'commit_size': (int,),  # noqa: E501
            'num_output_threads_per_stream': (int,),  # noqa: E501
            'make_current_account_owner': (bool,),  # noqa: E501
            'is_multi_tenant': (bool,),  # noqa: E501
            'on_the_fly_source_connector_id': (str, none_type,),  # noqa: E501
            'reset_profiling_assignments': (bool,),  # noqa: E501
            'multiple_profiler_check': (bool,),  # noqa: E501
            'truncate_tables': (bool,),  # noqa: E501
            'drop_indexes': (bool,),  # noqa: E501
            'pre_script': (ComplianceJobScript,),  # noqa: E501
            'post_script': (ComplianceJobScript,),  # noqa: E501
            'enabled_tasks': ([str],),  # noqa: E501
            'tags': ([Tag],),  # noqa: E501
        }

    @cached_property
    def discriminator():
        return None


    attribute_map = {
        'name': 'name',  # noqa: E501
        'rule_set_id': 'rule_set_id',  # noqa: E501
        'type': 'type',  # noqa: E501
        'description': 'description',  # noqa: E501
        'discovery_policy_id': 'discovery_policy_id',  # noqa: E501
        'max_memory': 'max_memory',  # noqa: E501
        'min_memory': 'min_memory',  # noqa: E501
        'feedback_size': 'feedback_size',  # noqa: E501
        'stream_row_limit': 'stream_row_limit',  # noqa: E501
        'num_input_streams': 'num_input_streams',  # noqa: E501
        'fail_immediately': 'fail_immediately',  # noqa: E501
        'batch_update': 'batch_update',  # noqa: E501
        'commit_size': 'commit_size',  # noqa: E501
        'num_output_threads_per_stream': 'num_output_threads_per_stream',  # noqa: E501
        'make_current_account_owner': 'make_current_account_owner',  # noqa: E501
        'is_multi_tenant': 'is_multi_tenant',  # noqa: E501
        'on_the_fly_source_connector_id': 'on_the_fly_source_connector_id',  # noqa: E501
        'reset_profiling_assignments': 'reset_profiling_assignments',  # noqa: E501
        'multiple_profiler_check': 'multiple_profiler_check',  # noqa: E501
        'truncate_tables': 'truncate_tables',  # noqa: E501
        'drop_indexes': 'drop_indexes',  # noqa: E501
        'pre_script': 'pre_script',  # noqa: E501
        'post_script': 'post_script',  # noqa: E501
        'enabled_tasks': 'enabled_tasks',  # noqa: E501
        'tags': 'tags',  # noqa: E501
    }

    read_only_vars = {
    }

    _composed_schemas = {}

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

        Args:
            name (str): The name of this compliance job.
            rule_set_id (str): The ID of the Rule Set used by this compliance job.
            type (str): The type of compliance job.

        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,)
            description (str): A description of the compliance job.. [optional]  # noqa: E501
            discovery_policy_id (str): The ID of the discovery policy to use for this compliance job. This is only applicable for DISCOVERY jobs.. [optional]  # noqa: E501
            max_memory (int): The maximum amount of memory, in MB, that the compliance job can consume during execution. A value of 0 or omitting this field uses the default max memory set in application settings.. [optional]  # noqa: E501
            min_memory (int): The minimum amount of memory, in MB, that the compliance job can consume during execution. Omitting this field uses the default min memory set in application settings.. [optional]  # noqa: E501
            feedback_size (int): The granularity with which the system provides updates on the progress of the compliance job. For instance, a feedback size of 50000 results in log updates whenever 50000 rows are processed during the masking phase.. [optional] if omitted the server will use the default value of 50000  # noqa: E501
            stream_row_limit (int): This value constrains the total number of rows that may enter the job for each masking stream. A value of 0 means unlimited. A value of -1 selects the default value. The minimum explicit value allowed is 20.. [optional]  # noqa: E501
            num_input_streams (int): This field controls the amount of parallelism that the masking job uses to extract out the data to be masked. For instance, when masking a database, specifying 5 input streams results in the compliance job reading up to 5 database tables in parallel and then masking those 5 streams of data in parallel. The higher the value of this field, the more potential parallelism there will be in the job, but the masking job will consume more memory. If the number of input streams exceeds the number of units being masked (e.g. tables or files), then the excess streams will do nothing.. [optional] if omitted the server will use the default value of 1  # noqa: E501
            fail_immediately (bool): Whether to fail immediately or delay failure until job completion when a masking algorithm fails to mask its data.. [optional] if omitted the server will use the default value of False  # noqa: E501
            batch_update (bool): Whether the database load phase to output the masked data will be performed in batches. The size of the batches is determined by the field 'commit_size'.. [optional] if omitted the server will use the default value of True  # noqa: E501
            commit_size (int): The size of the database commits when performing batch updates. Omitting this field uses the default commit size set in application settings.. [optional]  # noqa: E501
            num_output_threads_per_stream (int): The amount of parallelism, per input stream, that the job uses to load back the masked data. For example, specifying 4 output threads per stream with 5 input streams results in a total of 20 output threads for the whole job.. [optional] if omitted the server will use the default value of 1  # noqa: E501
            make_current_account_owner (bool): Whether the account creating this compliance job should be configured as its owner.. [optional] if omitted the server will use the default value of True  # noqa: E501
            is_multi_tenant (bool): If true, this job must be executed using a connector that is different from the underlying connector associated with its ruleset.. [optional] if omitted the server will use the default value of False  # noqa: E501
            on_the_fly_source_connector_id (str, none_type): The ID of the OTF source connector for this job.. [optional]  # noqa: E501
            reset_profiling_assignments (bool): Determines whether the ruleset assignments for the previous profiling execution need to be cleared before this job gets executed.. [optional]  # noqa: E501
            multiple_profiler_check (bool): When enabled, assigns a default algorithm if multiple classifiers match across different data classes above the threshold.. [optional]  # noqa: E501
            truncate_tables (bool): Whether to truncate target database tables before loading masked data. Only applies to database on-the-fly masking jobs.. [optional] if omitted the server will use the default value of False  # noqa: E501
            drop_indexes (bool): Whether to temporarily drop indexes prior to masking. This only applies to MySQL/MariaDB masking jobs. Other platforms should use enabled_tasks.. [optional] if omitted the server will use the default value of False  # noqa: E501
            pre_script (ComplianceJobScript): [optional]  # noqa: E501
            post_script (ComplianceJobScript): [optional]  # noqa: E501
            enabled_tasks ([str]): Tasks to perform before/after a job from a set of available driver support tasks as indicated by the target rule-set's connector.. [optional]  # noqa: E501
            tags ([Tag]): The tags to set on the compliance job.. [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__,)

        self.name = name
        self.rule_set_id = rule_set_id
        self.type = type
        for var_name, var_value in kwargs.items():
            if var_name not in self.attribute_map and \
                        self._configuration is not None and \
                        self._configuration.discard_unknown_keys and \
                        self.additional_properties_type is None:
                # 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',
    ])

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

        Args:
            name (str): The name of this compliance job.
            rule_set_id (str): The ID of the Rule Set used by this compliance job.
            type (str): The type of compliance job.

        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,)
            description (str): A description of the compliance job.. [optional]  # noqa: E501
            discovery_policy_id (str): The ID of the discovery policy to use for this compliance job. This is only applicable for DISCOVERY jobs.. [optional]  # noqa: E501
            max_memory (int): The maximum amount of memory, in MB, that the compliance job can consume during execution. A value of 0 or omitting this field uses the default max memory set in application settings.. [optional]  # noqa: E501
            min_memory (int): The minimum amount of memory, in MB, that the compliance job can consume during execution. Omitting this field uses the default min memory set in application settings.. [optional]  # noqa: E501
            feedback_size (int): The granularity with which the system provides updates on the progress of the compliance job. For instance, a feedback size of 50000 results in log updates whenever 50000 rows are processed during the masking phase.. [optional] if omitted the server will use the default value of 50000  # noqa: E501
            stream_row_limit (int): This value constrains the total number of rows that may enter the job for each masking stream. A value of 0 means unlimited. A value of -1 selects the default value. The minimum explicit value allowed is 20.. [optional]  # noqa: E501
            num_input_streams (int): This field controls the amount of parallelism that the masking job uses to extract out the data to be masked. For instance, when masking a database, specifying 5 input streams results in the compliance job reading up to 5 database tables in parallel and then masking those 5 streams of data in parallel. The higher the value of this field, the more potential parallelism there will be in the job, but the masking job will consume more memory. If the number of input streams exceeds the number of units being masked (e.g. tables or files), then the excess streams will do nothing.. [optional] if omitted the server will use the default value of 1  # noqa: E501
            fail_immediately (bool): Whether to fail immediately or delay failure until job completion when a masking algorithm fails to mask its data.. [optional] if omitted the server will use the default value of False  # noqa: E501
            batch_update (bool): Whether the database load phase to output the masked data will be performed in batches. The size of the batches is determined by the field 'commit_size'.. [optional] if omitted the server will use the default value of True  # noqa: E501
            commit_size (int): The size of the database commits when performing batch updates. Omitting this field uses the default commit size set in application settings.. [optional]  # noqa: E501
            num_output_threads_per_stream (int): The amount of parallelism, per input stream, that the job uses to load back the masked data. For example, specifying 4 output threads per stream with 5 input streams results in a total of 20 output threads for the whole job.. [optional] if omitted the server will use the default value of 1  # noqa: E501
            make_current_account_owner (bool): Whether the account creating this compliance job should be configured as its owner.. [optional] if omitted the server will use the default value of True  # noqa: E501
            is_multi_tenant (bool): If true, this job must be executed using a connector that is different from the underlying connector associated with its ruleset.. [optional] if omitted the server will use the default value of False  # noqa: E501
            on_the_fly_source_connector_id (str, none_type): The ID of the OTF source connector for this job.. [optional]  # noqa: E501
            reset_profiling_assignments (bool): Determines whether the ruleset assignments for the previous profiling execution need to be cleared before this job gets executed.. [optional]  # noqa: E501
            multiple_profiler_check (bool): When enabled, assigns a default algorithm if multiple classifiers match across different data classes above the threshold.. [optional]  # noqa: E501
            truncate_tables (bool): Whether to truncate target database tables before loading masked data. Only applies to database on-the-fly masking jobs.. [optional] if omitted the server will use the default value of False  # noqa: E501
            drop_indexes (bool): Whether to temporarily drop indexes prior to masking. This only applies to MySQL/MariaDB masking jobs. Other platforms should use enabled_tasks.. [optional] if omitted the server will use the default value of False  # noqa: E501
            pre_script (ComplianceJobScript): [optional]  # noqa: E501
            post_script (ComplianceJobScript): [optional]  # noqa: E501
            enabled_tasks ([str]): Tasks to perform before/after a job from a set of available driver support tasks as indicated by the target rule-set's connector.. [optional]  # noqa: E501
            tags ([Tag]): The tags to set on the compliance job.. [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__,)

        self.name = name
        self.rule_set_id = rule_set_id
        self.type = type
        for var_name, var_value in kwargs.items():
            if var_name not in self.attribute_map and \
                        self._configuration is not None and \
                        self._configuration.discard_unknown_keys and \
                        self.additional_properties_type is None:
                # 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.")
