# 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 .notification_target import NotificationTarget


class WorkflowAlert(UniversalBaseModel):
    """
    Describes the configuration for the workflow alerts
    """

    notification_target: typing.Optional[NotificationTarget] = None
    on_completion: typing.Optional[bool] = pydantic.Field(default=False)
    """
    Send an alert when the job completes
    """

    on_failure: typing.Optional[bool] = pydantic.Field(default=True)
    """
    Send an alert when the job fails
    """

    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
