# 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
from ..core.serialization import FieldMetadata
from ..core.unchecked_base_model import UncheckedBaseModel
from .external_data_validation_step_definition_config_failure_behavior import (
    ExternalDataValidationStepDefinitionConfigFailureBehavior,
)
from .external_data_validation_step_definition_config_request_options import (
    ExternalDataValidationStepDefinitionConfigRequestOptions,
)


class ExternalDataValidationStepDefinitionConfig(UncheckedBaseModel):
    """
    Optional on create/update. Required before the workflow can be deployed. Omitted in responses when the step is not yet configured.
    """

    request_options: typing_extensions.Annotated[
        ExternalDataValidationStepDefinitionConfigRequestOptions, FieldMetadata(alias="requestOptions")
    ] = pydantic.Field(alias="requestOptions")
    """
    HTTP request configuration for the external validation call.
    
    See the [External Data Validation step docs](https://docs.extend.ai/2026-02-09/product/workflows/configuring-workflows-via-api#external-data-validation-step).
    """

    failure_behavior: typing_extensions.Annotated[
        typing.Optional[ExternalDataValidationStepDefinitionConfigFailureBehavior],
        FieldMetadata(alias="failureBehavior"),
    ] = pydantic.Field(alias="failureBehavior", default=None)
    """
    Whether to continue or exit the workflow on validation failure. Defaults to `CONTINUE`.
    
    See the [External Data Validation step docs](https://docs.extend.ai/2026-02-09/product/workflows/configuring-workflows-via-api#external-data-validation-step).
    """

    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
