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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .enforcing_strategy import EnforcingStrategy
from .prompt_foo_guardrail_config_config import PromptFooGuardrailConfigConfig
from .prompt_foo_guardrail_config_operation import PromptFooGuardrailConfigOperation


class PromptFooGuardrailConfig(UniversalBaseModel):
    """
    PromptFoo
    """

    name: str = pydantic.Field()
    """
    The name of the Guardrail Config.
    """

    description: typing.Optional[str] = pydantic.Field(
        default="PromptFoo guardrails: guard check, PII redaction, or harmful content detection"
    )
    """
    Optional description for this Guardrail Config.
    """

    type: typing.Literal["integration/guardrail-config/promptfoo"] = pydantic.Field(
        default="integration/guardrail-config/promptfoo"
    )
    """
    +uiType=Hidden
    +value=integration/guardrail-config/promptfoo
    """

    operation: PromptFooGuardrailConfigOperation = pydantic.Field()
    """
    The operation type to use for the Guardrail. Validate guardrails are used to validate requests and mutate can validate as well as mutate requests.
    """

    priority: typing.Optional[int] = pydantic.Field(default=1)
    """
    Execution order for mutate guardrails. Lower values run first. Only applicable when operation is mutate.
    """

    enforcing_strategy: EnforcingStrategy
    config: PromptFooGuardrailConfigConfig

    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
