"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .contentfilterbuiltinaction import ContentFilterBuiltinAction
from .contentfilterbuiltinslug import ContentFilterBuiltinSlug
from .promptinjectionscanscope import PromptInjectionScanScope
from openrouter.types import BaseModel
from openrouter.utils import validate_open_enum
from pydantic.functional_validators import PlainValidator
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class ContentFilterBuiltinEntryTypedDict(TypedDict):
    r"""A builtin content filter entry. Builtin filters include PII detectors and the regex-based prompt injection detector."""

    action: ContentFilterBuiltinAction
    r"""Action taken when the builtin filter triggers"""
    slug: ContentFilterBuiltinSlug
    r"""The builtin filter identifier"""
    label: NotRequired[str]
    r"""Read-only, system-assigned redaction placeholder derived from the slug (e.g. \"[EMAIL]\", \"[PHONE]\"). Not settable by the caller."""
    scan_scope: NotRequired[PromptInjectionScanScope]
    r"""Which message roles to scan for prompt injection. Only applies to the regex-prompt-injection builtin. Defaults to all_messages."""


class ContentFilterBuiltinEntry(BaseModel):
    r"""A builtin content filter entry. Builtin filters include PII detectors and the regex-based prompt injection detector."""

    action: Annotated[
        ContentFilterBuiltinAction, PlainValidator(validate_open_enum(False))
    ]
    r"""Action taken when the builtin filter triggers"""

    slug: Annotated[ContentFilterBuiltinSlug, PlainValidator(validate_open_enum(False))]
    r"""The builtin filter identifier"""

    label: Optional[str] = None
    r"""Read-only, system-assigned redaction placeholder derived from the slug (e.g. \"[EMAIL]\", \"[PHONE]\"). Not settable by the caller."""

    scan_scope: Annotated[
        Optional[PromptInjectionScanScope], PlainValidator(validate_open_enum(False))
    ] = None
    r"""Which message roles to scan for prompt injection. Only applies to the regex-prompt-injection builtin. Defaults to all_messages."""
