"""
    Ory APIs

    Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.   # noqa: E501

    The version of the OpenAPI document: v0.0.1-alpha.53
    Contact: support@ory.sh
    Generated by: https://openapi-generator.tech
"""


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

from ory_client.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 ory_client.exceptions import ApiAttributeError


def lazy_import():
    from ory_client.model.project_lookup_secret_config import ProjectLookupSecretConfig
    from ory_client.model.project_password_config import ProjectPasswordConfig
    from ory_client.model.project_recovery_config import ProjectRecoveryConfig
    from ory_client.model.project_totp_config import ProjectTotpConfig
    from ory_client.model.project_verification_config import ProjectVerificationConfig
    from ory_client.model.project_web_authn_config import ProjectWebAuthnConfig
    from ory_client.model.redirection_config import RedirectionConfig
    globals()['ProjectLookupSecretConfig'] = ProjectLookupSecretConfig
    globals()['ProjectPasswordConfig'] = ProjectPasswordConfig
    globals()['ProjectRecoveryConfig'] = ProjectRecoveryConfig
    globals()['ProjectTotpConfig'] = ProjectTotpConfig
    globals()['ProjectVerificationConfig'] = ProjectVerificationConfig
    globals()['ProjectWebAuthnConfig'] = ProjectWebAuthnConfig
    globals()['RedirectionConfig'] = RedirectionConfig


class ProjectPatch(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 = {
    }

    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 {
            'error_ui_url': (str,),  # noqa: E501
            'login_ui_url': (str,),  # noqa: E501
            'lookup_secret': (ProjectLookupSecretConfig,),  # noqa: E501
            'password': (ProjectPasswordConfig,),  # noqa: E501
            'recovery': (ProjectRecoveryConfig,),  # noqa: E501
            'recovery_ui_url': (str,),  # noqa: E501
            'registration_ui_url': (str,),  # noqa: E501
            'session_after_sign_up': (bool,),  # noqa: E501
            'session_soft_2fa': (bool,),  # noqa: E501
            'settings_privileged_session_max_age_seconds': (int,),  # noqa: E501
            'settings_soft_2fa': (bool,),  # noqa: E501
            'settings_ui_url': (str,),  # noqa: E501
            'totp': (ProjectTotpConfig,),  # noqa: E501
            'verification': (ProjectVerificationConfig,),  # noqa: E501
            'verification_ui_url': (str,),  # noqa: E501
            'webauthn': (ProjectWebAuthnConfig,),  # noqa: E501
            'api_url': (str,),  # noqa: E501
            'application_url': (str,),  # noqa: E501
            'default_identity_schema_url': (str,),  # noqa: E501
            'kratos_custom_schema_id': (str,),  # noqa: E501
            'name': (str,),  # noqa: E501
            'redirection_config': (RedirectionConfig,),  # noqa: E501
        }

    @cached_property
    def discriminator():
        return None


    attribute_map = {
        'error_ui_url': 'error_ui_url',  # noqa: E501
        'login_ui_url': 'login_ui_url',  # noqa: E501
        'lookup_secret': 'lookup_secret',  # noqa: E501
        'password': 'password',  # noqa: E501
        'recovery': 'recovery',  # noqa: E501
        'recovery_ui_url': 'recovery_ui_url',  # noqa: E501
        'registration_ui_url': 'registration_ui_url',  # noqa: E501
        'session_after_sign_up': 'session_after_sign_up',  # noqa: E501
        'session_soft_2fa': 'session_soft_2fa',  # noqa: E501
        'settings_privileged_session_max_age_seconds': 'settings_privileged_session_max_age_seconds',  # noqa: E501
        'settings_soft_2fa': 'settings_soft_2fa',  # noqa: E501
        'settings_ui_url': 'settings_ui_url',  # noqa: E501
        'totp': 'totp',  # noqa: E501
        'verification': 'verification',  # noqa: E501
        'verification_ui_url': 'verification_ui_url',  # noqa: E501
        'webauthn': 'webauthn',  # noqa: E501
        'api_url': 'api_url',  # noqa: E501
        'application_url': 'application_url',  # noqa: E501
        'default_identity_schema_url': 'default_identity_schema_url',  # noqa: E501
        'kratos_custom_schema_id': 'kratos_custom_schema_id',  # noqa: E501
        'name': 'name',  # noqa: E501
        'redirection_config': 'redirection_config',  # noqa: E501
    }

    read_only_vars = {
    }

    _composed_schemas = {}

    @classmethod
    @convert_js_args_to_python_args
    def _from_openapi_data(cls, error_ui_url, login_ui_url, lookup_secret, password, recovery, recovery_ui_url, registration_ui_url, session_after_sign_up, session_soft_2fa, settings_privileged_session_max_age_seconds, settings_soft_2fa, settings_ui_url, totp, verification, verification_ui_url, webauthn, *args, **kwargs):  # noqa: E501
        """ProjectPatch - a model defined in OpenAPI

        Args:
            error_ui_url (str): Self-Service Error UI URL  Sets the UI URL for the error UI. If left empty, this will use Ory's hosted pages.
            login_ui_url (str): Self-Service Login UI URL  Sets the UI URL for the login UI. If left empty, this will use Ory's hosted pages.
            lookup_secret (ProjectLookupSecretConfig):
            password (ProjectPasswordConfig):
            recovery (ProjectRecoveryConfig):
            recovery_ui_url (str): Self-Service Login UI URL  Sets the UI URL for the recovery UI. If left empty, this will use Ory's hosted pages.
            registration_ui_url (str): Self-Service Login UI URL  Sets the UI URL for the registration UI. If left empty, this will use Ory's hosted pages.
            session_after_sign_up (bool): Issue Session after Sign Up  If set to true, users will receive a session after they successfully signed up. Enabling this option allows account enumeration during registration flows. Read more: https://www.ory.sh/kratos/docs/self-service/flows/user-registration#successful-registration
            session_soft_2fa (bool): Enable Soft 2FA for Login Sessions
            settings_privileged_session_max_age_seconds (int): Duration in Seconds of how long a Session is Privileged  Defines how long a session is considered privileged in seconds. If the session's authenticated_at is older than the value specified here, the user needs to re-authenticate to perform certain actions (e.g. password change).
            settings_soft_2fa (bool): Enable Soft 2FA for Self-Service Settings Flows
            settings_ui_url (str): Self-Service Settings UI URL  Sets the UI URL for the settings UI. If left empty, this will use Ory's hosted pages.
            totp (ProjectTotpConfig):
            verification (ProjectVerificationConfig):
            verification_ui_url (str): Self-Service Login UI URL  Sets the UI URL for the verification UI. If left empty, this will use Ory's hosted pages.
            webauthn (ProjectWebAuthnConfig):

        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,)
            api_url (str): URL of Project API  In the future will allow to override Kratos project URL. If set, error is returned. If left empty our hosted URL is used. [optional]  # noqa: E501
            application_url (str): URL where your application is available.  Your users will be redirected to this URL when they successfully complete a login, logout, verification, recovery, or registration flow. More fine-grained redirection patterns are available for the individual flows (login, registration, ...).  If left empty, our hosted URL will be used instead. It contains technical information on the identities and is useful when developing a new project or trying out Ory Cloud.. [optional]  # noqa: E501
            default_identity_schema_url (str): Default Identity Schema URL  This represents your Ory Kratos Default Identity Schema. It is your identity's default schema. This allows setting custom fields such as \"address\", specifying whether you want to log in using email or a username, and more. For more information on this topic, please check out the identity documentation.  If KratosCustomSchemaID is also added to the payload, it will be preferred and replace the value of DefaultIdentitySchemaURL set by the client.  The value of this field can be either any \"https://\" URL - for example a file hosted at GitHub, or a `preset://`-prefixed string.  Available presets are:  preset://email preset://username preset://basic preset://blank. [optional]  # noqa: E501
            kratos_custom_schema_id (str): The Custom Schema ID  The custom schema ID is a preferred field over DefaultIdentitySchemaURL, meaning it will override the DefaultIdentitySchemaURL with the custom schema's URL instead of accepting it from the client-side. Once this field is set the given custom schema will be associated with this project.. [optional]  # noqa: E501
            name (str): The project name.  Helps you identify your project.  in: body. [optional]  # noqa: E501
            redirection_config (RedirectionConfig): [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.error_ui_url = error_ui_url
        self.login_ui_url = login_ui_url
        self.lookup_secret = lookup_secret
        self.password = password
        self.recovery = recovery
        self.recovery_ui_url = recovery_ui_url
        self.registration_ui_url = registration_ui_url
        self.session_after_sign_up = session_after_sign_up
        self.session_soft_2fa = session_soft_2fa
        self.settings_privileged_session_max_age_seconds = settings_privileged_session_max_age_seconds
        self.settings_soft_2fa = settings_soft_2fa
        self.settings_ui_url = settings_ui_url
        self.totp = totp
        self.verification = verification
        self.verification_ui_url = verification_ui_url
        self.webauthn = webauthn
        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, error_ui_url, login_ui_url, lookup_secret, password, recovery, recovery_ui_url, registration_ui_url, session_after_sign_up, session_soft_2fa, settings_privileged_session_max_age_seconds, settings_soft_2fa, settings_ui_url, totp, verification, verification_ui_url, webauthn, *args, **kwargs):  # noqa: E501
        """ProjectPatch - a model defined in OpenAPI

        Args:
            error_ui_url (str): Self-Service Error UI URL  Sets the UI URL for the error UI. If left empty, this will use Ory's hosted pages.
            login_ui_url (str): Self-Service Login UI URL  Sets the UI URL for the login UI. If left empty, this will use Ory's hosted pages.
            lookup_secret (ProjectLookupSecretConfig):
            password (ProjectPasswordConfig):
            recovery (ProjectRecoveryConfig):
            recovery_ui_url (str): Self-Service Login UI URL  Sets the UI URL for the recovery UI. If left empty, this will use Ory's hosted pages.
            registration_ui_url (str): Self-Service Login UI URL  Sets the UI URL for the registration UI. If left empty, this will use Ory's hosted pages.
            session_after_sign_up (bool): Issue Session after Sign Up  If set to true, users will receive a session after they successfully signed up. Enabling this option allows account enumeration during registration flows. Read more: https://www.ory.sh/kratos/docs/self-service/flows/user-registration#successful-registration
            session_soft_2fa (bool): Enable Soft 2FA for Login Sessions
            settings_privileged_session_max_age_seconds (int): Duration in Seconds of how long a Session is Privileged  Defines how long a session is considered privileged in seconds. If the session's authenticated_at is older than the value specified here, the user needs to re-authenticate to perform certain actions (e.g. password change).
            settings_soft_2fa (bool): Enable Soft 2FA for Self-Service Settings Flows
            settings_ui_url (str): Self-Service Settings UI URL  Sets the UI URL for the settings UI. If left empty, this will use Ory's hosted pages.
            totp (ProjectTotpConfig):
            verification (ProjectVerificationConfig):
            verification_ui_url (str): Self-Service Login UI URL  Sets the UI URL for the verification UI. If left empty, this will use Ory's hosted pages.
            webauthn (ProjectWebAuthnConfig):

        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,)
            api_url (str): URL of Project API  In the future will allow to override Kratos project URL. If set, error is returned. If left empty our hosted URL is used. [optional]  # noqa: E501
            application_url (str): URL where your application is available.  Your users will be redirected to this URL when they successfully complete a login, logout, verification, recovery, or registration flow. More fine-grained redirection patterns are available for the individual flows (login, registration, ...).  If left empty, our hosted URL will be used instead. It contains technical information on the identities and is useful when developing a new project or trying out Ory Cloud.. [optional]  # noqa: E501
            default_identity_schema_url (str): Default Identity Schema URL  This represents your Ory Kratos Default Identity Schema. It is your identity's default schema. This allows setting custom fields such as \"address\", specifying whether you want to log in using email or a username, and more. For more information on this topic, please check out the identity documentation.  If KratosCustomSchemaID is also added to the payload, it will be preferred and replace the value of DefaultIdentitySchemaURL set by the client.  The value of this field can be either any \"https://\" URL - for example a file hosted at GitHub, or a `preset://`-prefixed string.  Available presets are:  preset://email preset://username preset://basic preset://blank. [optional]  # noqa: E501
            kratos_custom_schema_id (str): The Custom Schema ID  The custom schema ID is a preferred field over DefaultIdentitySchemaURL, meaning it will override the DefaultIdentitySchemaURL with the custom schema's URL instead of accepting it from the client-side. Once this field is set the given custom schema will be associated with this project.. [optional]  # noqa: E501
            name (str): The project name.  Helps you identify your project.  in: body. [optional]  # noqa: E501
            redirection_config (RedirectionConfig): [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.error_ui_url = error_ui_url
        self.login_ui_url = login_ui_url
        self.lookup_secret = lookup_secret
        self.password = password
        self.recovery = recovery
        self.recovery_ui_url = recovery_ui_url
        self.registration_ui_url = registration_ui_url
        self.session_after_sign_up = session_after_sign_up
        self.session_soft_2fa = session_soft_2fa
        self.settings_privileged_session_max_age_seconds = settings_privileged_session_max_age_seconds
        self.settings_soft_2fa = settings_soft_2fa
        self.settings_ui_url = settings_ui_url
        self.totp = totp
        self.verification = verification
        self.verification_ui_url = verification_ui_url
        self.webauthn = webauthn
        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.")
