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

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
from ..core.serialization import FieldMetadata
from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata
from .astllm_node_input import AstllmNodeInput


class AstNodeInput_AddOperator(UncheckedBaseModel):
    type: typing.Literal["add_operator"] = "add_operator"
    left: "AstNodeInput"
    right: "AstNodeInput"

    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


class AstNodeInput_AndOperator(UncheckedBaseModel):
    type: typing.Literal["and_operator"] = "and_operator"
    children: typing.List["AstNodeInput"]

    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


class AstNodeInput_BooleanLiteral(UncheckedBaseModel):
    type: typing.Literal["boolean_literal"] = "boolean_literal"
    value: bool

    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


class AstNodeInput_ConditionalOperator(UncheckedBaseModel):
    type: typing.Literal["conditional_operator"] = "conditional_operator"
    condition: "AstNodeInput"
    true_expression: typing_extensions.Annotated["AstNodeInput", FieldMetadata(alias="trueExpression")]
    false_expression: typing_extensions.Annotated["AstNodeInput", FieldMetadata(alias="falseExpression")]

    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


class AstNodeInput_DivOperator(UncheckedBaseModel):
    type: typing.Literal["div_operator"] = "div_operator"
    left: "AstNodeInput"
    right: "AstNodeInput"

    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


class AstNodeInput_DynamicVariable(UncheckedBaseModel):
    type: typing.Literal["dynamic_variable"] = "dynamic_variable"
    name: str

    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


class AstNodeInput_EqOperator(UncheckedBaseModel):
    type: typing.Literal["eq_operator"] = "eq_operator"
    left: "AstNodeInput"
    right: "AstNodeInput"

    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


class AstNodeInput_GtOperator(UncheckedBaseModel):
    type: typing.Literal["gt_operator"] = "gt_operator"
    left: "AstNodeInput"
    right: "AstNodeInput"

    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


class AstNodeInput_GteOperator(UncheckedBaseModel):
    type: typing.Literal["gte_operator"] = "gte_operator"
    left: "AstNodeInput"
    right: "AstNodeInput"

    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


class AstNodeInput_Llm(UncheckedBaseModel):
    value: AstllmNodeInput
    type: typing.Literal["llm"] = "llm"

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True


class AstNodeInput_LtOperator(UncheckedBaseModel):
    type: typing.Literal["lt_operator"] = "lt_operator"
    left: "AstNodeInput"
    right: "AstNodeInput"

    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


class AstNodeInput_LteOperator(UncheckedBaseModel):
    type: typing.Literal["lte_operator"] = "lte_operator"
    left: "AstNodeInput"
    right: "AstNodeInput"

    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


class AstNodeInput_MulOperator(UncheckedBaseModel):
    type: typing.Literal["mul_operator"] = "mul_operator"
    left: "AstNodeInput"
    right: "AstNodeInput"

    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


class AstNodeInput_NeqOperator(UncheckedBaseModel):
    type: typing.Literal["neq_operator"] = "neq_operator"
    left: "AstNodeInput"
    right: "AstNodeInput"

    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


class AstNodeInput_NullLiteral(UncheckedBaseModel):
    type: typing.Literal["null_literal"] = "null_literal"

    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


class AstNodeInput_NumberLiteral(UncheckedBaseModel):
    type: typing.Literal["number_literal"] = "number_literal"
    value: float

    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


class AstNodeInput_OrOperator(UncheckedBaseModel):
    type: typing.Literal["or_operator"] = "or_operator"
    children: typing.List["AstNodeInput"]

    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


class AstNodeInput_StringLiteral(UncheckedBaseModel):
    type: typing.Literal["string_literal"] = "string_literal"
    value: str

    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


class AstNodeInput_SubOperator(UncheckedBaseModel):
    type: typing.Literal["sub_operator"] = "sub_operator"
    left: "AstNodeInput"
    right: "AstNodeInput"

    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


AstNodeInput = typing_extensions.Annotated[
    typing.Union[
        AstNodeInput_AddOperator,
        AstNodeInput_AndOperator,
        AstNodeInput_BooleanLiteral,
        AstNodeInput_ConditionalOperator,
        AstNodeInput_DivOperator,
        AstNodeInput_DynamicVariable,
        AstNodeInput_EqOperator,
        AstNodeInput_GtOperator,
        AstNodeInput_GteOperator,
        AstNodeInput_Llm,
        AstNodeInput_LtOperator,
        AstNodeInput_LteOperator,
        AstNodeInput_MulOperator,
        AstNodeInput_NeqOperator,
        AstNodeInput_NullLiteral,
        AstNodeInput_NumberLiteral,
        AstNodeInput_OrOperator,
        AstNodeInput_StringLiteral,
        AstNodeInput_SubOperator,
    ],
    UnionMetadata(discriminant="type"),
]
update_forward_refs(AstNodeInput_AddOperator)
update_forward_refs(AstNodeInput_AndOperator)
update_forward_refs(AstNodeInput_ConditionalOperator)
update_forward_refs(AstNodeInput_DivOperator)
update_forward_refs(AstNodeInput_EqOperator)
update_forward_refs(AstNodeInput_GtOperator)
update_forward_refs(AstNodeInput_GteOperator)
update_forward_refs(AstNodeInput_LtOperator)
update_forward_refs(AstNodeInput_LteOperator)
update_forward_refs(AstNodeInput_MulOperator)
update_forward_refs(AstNodeInput_NeqOperator)
update_forward_refs(AstNodeInput_OrOperator)
update_forward_refs(AstNodeInput_SubOperator)
