# 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 .conditional_step_definition_config_conditions_item_operation import (
    ConditionalStepDefinitionConfigConditionsItemOperation,
)
from .conditional_step_definition_config_conditions_item_type import ConditionalStepDefinitionConfigConditionsItemType


class ConditionalStepDefinitionConfigConditionsItem(UncheckedBaseModel):
    id: str = pydantic.Field()
    """
    Unique ID for this condition branch.
    """

    type: ConditionalStepDefinitionConfigConditionsItemType
    operation: typing.Optional[ConditionalStepDefinitionConfigConditionsItemOperation] = pydantic.Field(default=None)
    """
    The comparison operation for this branch.
    
    See the [Conditional step docs](https://docs.extend.ai/2026-02-09/product/workflows/configuring-workflows-via-api#conditional-step).
    """

    left_operand: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="leftOperand")] = (
        pydantic.Field(alias="leftOperand", default=None)
    )
    """
    The left operand expression. This is typically a workflow variable or dynamic expression.
    
    See the [Conditional step docs](https://docs.extend.ai/2026-02-09/product/workflows/configuring-workflows-via-api#conditional-step).
    """

    right_operand: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="rightOperand")] = (
        pydantic.Field(alias="rightOperand", default=None)
    )
    """
    The right operand value. This is typically a literal comparison value and is omitted for fallback branches like `ELSE`.
    
    See the [Conditional step docs](https://docs.extend.ai/2026-02-09/product/workflows/configuring-workflows-via-api#conditional-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
