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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class SqlSanitizerGuardrailConfigConfig(UniversalBaseModel):
    block_drop: typing.Optional[bool] = pydantic.Field(default=True)
    """
    Block SQL DROP statements as dangerous operations.
    """

    block_truncate: typing.Optional[bool] = pydantic.Field(default=True)
    """
    Block SQL TRUNCATE statements as dangerous operations.
    """

    block_alter: typing.Optional[bool] = pydantic.Field(default=True)
    """
    Block SQL ALTER statements as dangerous operations.
    """

    block_grant: typing.Optional[bool] = pydantic.Field(default=True)
    """
    Block SQL GRANT statements as dangerous operations.
    """

    block_revoke: typing.Optional[bool] = pydantic.Field(default=True)
    """
    Block SQL REVOKE statements as dangerous operations.
    """

    strip_comments: typing.Optional[bool] = pydantic.Field(default=True)
    """
    Remove SQL comments (-- and block comments) from queries. In mutate mode, comments are stripped from the output.
    """

    block_delete_without_where: typing.Optional[bool] = pydantic.Field(default=True)
    """
    Flag DELETE FROM statements that lack a WHERE clause as potentially dangerous.
    """

    block_update_without_where: typing.Optional[bool] = pydantic.Field(default=True)
    """
    Flag UPDATE statements that lack a WHERE clause as potentially dangerous.
    """

    require_parameterization: typing.Optional[bool] = pydantic.Field(default=False)
    """
    Detect naive string interpolation patterns (+, %., {}) that may indicate SQL injection vulnerabilities.
    """

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

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