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

from ..core.pydantic_utilities import UniversalBaseModel
from .api_request_parent_context import ApiRequestParentContext
from .external_parent_context import ExternalParentContext
from .node_parent_context import NodeParentContext
from .prompt_deployment_parent_context import PromptDeploymentParentContext
from .span_link import SpanLink
from .workflow_deployment_parent_context import WorkflowDeploymentParentContext
from .workflow_parent_context import WorkflowParentContext
from .workflow_sandbox_parent_context import WorkflowSandboxParentContext
import typing
from .vellum_node_execution_event import VellumNodeExecutionEvent
from .node_execution_span_attributes import NodeExecutionSpanAttributes
from .workflow_execution_usage_calculation_fulfilled_body import WorkflowExecutionUsageCalculationFulfilledBody
import datetime as dt
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic


class NodeExecutionSpan(UniversalBaseModel):
    name: typing.Literal["node.execution"] = "node.execution"
    events: typing.List[VellumNodeExecutionEvent]
    attributes: NodeExecutionSpanAttributes
    usage_result: typing.Optional[WorkflowExecutionUsageCalculationFulfilledBody] = None
    span_id: str
    start_ts: dt.datetime
    end_ts: dt.datetime
    parent_span_id: typing.Optional[str] = None

    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
