# 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 .llm_literal_json_schema_property import LlmLiteralJsonSchemaProperty


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

    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 AstNodeOutput_AndOperator(UncheckedBaseModel):
    type: typing.Literal["and_operator"] = "and_operator"
    children: typing.List["AstNodeOutput"]

    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 AstNodeOutput_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 AstNodeOutput_ConditionalOperator(UncheckedBaseModel):
    type: typing.Literal["conditional_operator"] = "conditional_operator"
    condition: "AstNodeOutput"
    true_expression: typing_extensions.Annotated["AstNodeOutput", FieldMetadata(alias="trueExpression")]
    false_expression: typing_extensions.Annotated["AstNodeOutput", 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 AstNodeOutput_DivOperator(UncheckedBaseModel):
    type: typing.Literal["div_operator"] = "div_operator"
    left: "AstNodeOutput"
    right: "AstNodeOutput"

    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 AstNodeOutput_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 AstNodeOutput_EqOperator(UncheckedBaseModel):
    type: typing.Literal["eq_operator"] = "eq_operator"
    left: "AstNodeOutput"
    right: "AstNodeOutput"

    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 AstNodeOutput_GtOperator(UncheckedBaseModel):
    type: typing.Literal["gt_operator"] = "gt_operator"
    left: "AstNodeOutput"
    right: "AstNodeOutput"

    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 AstNodeOutput_GteOperator(UncheckedBaseModel):
    type: typing.Literal["gte_operator"] = "gte_operator"
    left: "AstNodeOutput"
    right: "AstNodeOutput"

    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 AstNodeOutput_Llm(UncheckedBaseModel):
    type: typing.Literal["llm"] = "llm"
    value_schema: LlmLiteralJsonSchemaProperty
    prompt: 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 AstNodeOutput_LtOperator(UncheckedBaseModel):
    type: typing.Literal["lt_operator"] = "lt_operator"
    left: "AstNodeOutput"
    right: "AstNodeOutput"

    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 AstNodeOutput_LteOperator(UncheckedBaseModel):
    type: typing.Literal["lte_operator"] = "lte_operator"
    left: "AstNodeOutput"
    right: "AstNodeOutput"

    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 AstNodeOutput_MulOperator(UncheckedBaseModel):
    type: typing.Literal["mul_operator"] = "mul_operator"
    left: "AstNodeOutput"
    right: "AstNodeOutput"

    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 AstNodeOutput_NeqOperator(UncheckedBaseModel):
    type: typing.Literal["neq_operator"] = "neq_operator"
    left: "AstNodeOutput"
    right: "AstNodeOutput"

    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 AstNodeOutput_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 AstNodeOutput_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 AstNodeOutput_OrOperator(UncheckedBaseModel):
    type: typing.Literal["or_operator"] = "or_operator"
    children: typing.List["AstNodeOutput"]

    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 AstNodeOutput_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 AstNodeOutput_SubOperator(UncheckedBaseModel):
    type: typing.Literal["sub_operator"] = "sub_operator"
    left: "AstNodeOutput"
    right: "AstNodeOutput"

    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


AstNodeOutput = typing_extensions.Annotated[
    typing.Union[
        AstNodeOutput_AddOperator,
        AstNodeOutput_AndOperator,
        AstNodeOutput_BooleanLiteral,
        AstNodeOutput_ConditionalOperator,
        AstNodeOutput_DivOperator,
        AstNodeOutput_DynamicVariable,
        AstNodeOutput_EqOperator,
        AstNodeOutput_GtOperator,
        AstNodeOutput_GteOperator,
        AstNodeOutput_Llm,
        AstNodeOutput_LtOperator,
        AstNodeOutput_LteOperator,
        AstNodeOutput_MulOperator,
        AstNodeOutput_NeqOperator,
        AstNodeOutput_NullLiteral,
        AstNodeOutput_NumberLiteral,
        AstNodeOutput_OrOperator,
        AstNodeOutput_StringLiteral,
        AstNodeOutput_SubOperator,
    ],
    UnionMetadata(discriminant="type"),
]
update_forward_refs(AstNodeOutput_AddOperator)
update_forward_refs(AstNodeOutput_AndOperator)
update_forward_refs(AstNodeOutput_ConditionalOperator)
update_forward_refs(AstNodeOutput_DivOperator)
update_forward_refs(AstNodeOutput_EqOperator)
update_forward_refs(AstNodeOutput_GtOperator)
update_forward_refs(AstNodeOutput_GteOperator)
update_forward_refs(AstNodeOutput_LtOperator)
update_forward_refs(AstNodeOutput_LteOperator)
update_forward_refs(AstNodeOutput_MulOperator)
update_forward_refs(AstNodeOutput_NeqOperator)
update_forward_refs(AstNodeOutput_OrOperator)
update_forward_refs(AstNodeOutput_SubOperator)
