# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .connection_assertion_decryption_settings import ConnectionAssertionDecryptionSettings
from .connection_attributes import ConnectionAttributes
from .connection_authentication_methods import ConnectionAuthenticationMethods
from .connection_custom_scripts import ConnectionCustomScripts
from .connection_dpop_signing_alg_enum import ConnectionDpopSigningAlgEnum
from .connection_gateway_authentication import ConnectionGatewayAuthentication
from .connection_id_token_session_expiry_supported import ConnectionIdTokenSessionExpirySupported
from .connection_id_token_signed_response_algs import ConnectionIdTokenSignedResponseAlgs
from .connection_identifier_precedence_enum import ConnectionIdentifierPrecedenceEnum
from .connection_passkey_options import ConnectionPasskeyOptions
from .connection_password_complexity_options import ConnectionPasswordComplexityOptions
from .connection_password_dictionary_options import ConnectionPasswordDictionaryOptions
from .connection_password_history_options import ConnectionPasswordHistoryOptions
from .connection_password_no_personal_info_options import ConnectionPasswordNoPersonalInfoOptions
from .connection_password_options import ConnectionPasswordOptions
from .connection_password_policy_enum import ConnectionPasswordPolicyEnum
from .connection_set_user_root_attributes_enum import ConnectionSetUserRootAttributesEnum
from .connection_token_endpoint_auth_method_enum import ConnectionTokenEndpointAuthMethodEnum
from .connection_token_endpoint_auth_signing_alg_enum import ConnectionTokenEndpointAuthSigningAlgEnum
from .connection_token_endpoint_jwtca_aud_format_enum_oidc import ConnectionTokenEndpointJwtcaAudFormatEnumOidc
from .connection_upstream_params import ConnectionUpstreamParams
from .connection_validation_options import ConnectionValidationOptions
from .connections_discovery_url import ConnectionsDiscoveryUrl
from .connections_oidc_metadata import ConnectionsOidcMetadata


class UpdateConnectionOptions(UniversalBaseModel):
    """
    The connection's options (depend on the connection strategy). To update these options, the `update:connections_options` scope must be present. To verify your changes, also include the `read:connections_options` scope. If this scope is not specified, you will not be able to review the updated object.
    """

    validation: typing.Optional[ConnectionValidationOptions] = None
    non_persistent_attrs: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    An array of user fields that should not be stored in the Auth0 database (https://auth0.com/docs/security/data-security/denylist)
    """

    precedence: typing.Optional[typing.List[ConnectionIdentifierPrecedenceEnum]] = pydantic.Field(default=None)
    """
    Order of precedence for attribute types. If the property is not specified, the default precedence of attributes will be used.
    """

    attributes: typing.Optional[ConnectionAttributes] = None
    enable_script_context: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Set to true to inject context into custom DB scripts (warning: cannot be disabled once enabled)
    """

    enabled_database_customization: typing_extensions.Annotated[
        typing.Optional[bool],
        FieldMetadata(alias="enabledDatabaseCustomization"),
        pydantic.Field(alias="enabledDatabaseCustomization", description="Set to true to use a legacy user store"),
    ] = None
    """
    Set to true to use a legacy user store
    """

    import_mode: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Enable this if you have a legacy user store and you want to gradually migrate those users to the Auth0 user store
    """

    configuration: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None)
    """
    Stores encrypted string only configurations for connections
    """

    custom_scripts: typing_extensions.Annotated[
        typing.Optional[ConnectionCustomScripts],
        FieldMetadata(alias="customScripts"),
        pydantic.Field(alias="customScripts"),
    ] = None
    authentication_methods: typing.Optional[ConnectionAuthenticationMethods] = None
    passkey_options: typing.Optional[ConnectionPasskeyOptions] = None
    password_policy: typing_extensions.Annotated[
        typing.Optional[ConnectionPasswordPolicyEnum],
        FieldMetadata(alias="passwordPolicy"),
        pydantic.Field(alias="passwordPolicy"),
    ] = None
    password_complexity_options: typing.Optional[ConnectionPasswordComplexityOptions] = None
    password_history: typing.Optional[ConnectionPasswordHistoryOptions] = None
    password_no_personal_info: typing.Optional[ConnectionPasswordNoPersonalInfoOptions] = None
    password_dictionary: typing.Optional[ConnectionPasswordDictionaryOptions] = None
    api_enable_users: typing.Optional[bool] = None
    api_enable_groups: typing.Optional[bool] = None
    basic_profile: typing.Optional[bool] = None
    ext_admin: typing.Optional[bool] = None
    ext_is_suspended: typing.Optional[bool] = None
    ext_agreed_terms: typing.Optional[bool] = None
    ext_groups: typing.Optional[bool] = None
    ext_assigned_plans: typing.Optional[bool] = None
    ext_profile: typing.Optional[bool] = None
    disable_self_service_change_password: typing.Optional[bool] = None
    upstream_params: typing.Optional[ConnectionUpstreamParams] = None
    set_user_root_attributes: typing.Optional[ConnectionSetUserRootAttributesEnum] = None
    gateway_authentication: typing.Optional[ConnectionGatewayAuthentication] = None
    password_options: typing.Optional[ConnectionPasswordOptions] = None
    assertion_decryption_settings: typing.Optional[ConnectionAssertionDecryptionSettings] = None
    id_token_signed_response_algs: typing.Optional[ConnectionIdTokenSignedResponseAlgs] = None
    dpop_signing_alg: typing.Optional[ConnectionDpopSigningAlgEnum] = None
    token_endpoint_auth_method: typing.Optional[ConnectionTokenEndpointAuthMethodEnum] = None
    token_endpoint_auth_signing_alg: typing.Optional[ConnectionTokenEndpointAuthSigningAlgEnum] = None
    token_endpoint_jwtca_aud_format: typing.Optional[ConnectionTokenEndpointJwtcaAudFormatEnumOidc] = None
    id_token_session_expiry_supported: typing.Optional[ConnectionIdTokenSessionExpirySupported] = None
    discovery_url: typing.Optional[ConnectionsDiscoveryUrl] = None
    oidc_metadata: typing.Optional[ConnectionsOidcMetadata] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
