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

from __future__ import annotations

import typing

import pydantic
from ..core.pydantic_utilities import (
    IS_PYDANTIC_V2,
    UniversalBaseModel,
    update_forward_refs,
)
from .exception_dto import ExceptionDto
from .lifecycle_dto import LifecycleDto
from .link_dto import LinkDto
from .node_dto import NodeDto
from .o_tel_extra_dto import OTelExtraDto
from .parent_dto import ParentDto
from .root_dto import RootDto
from .status_dto import StatusDto
from .time_dto import TimeDto
from .tree_dto import TreeDto


class SpanDto(UniversalBaseModel):
    trace_id: str
    span_id: str
    lifecycle: typing.Optional[LifecycleDto] = None
    root: RootDto
    tree: TreeDto
    node: NodeDto
    parent: typing.Optional[ParentDto] = None
    time: TimeDto
    status: StatusDto
    exception: typing.Optional[ExceptionDto] = None
    data: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
    metrics: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
    meta: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
    refs: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
    links: typing.Optional[typing.List[LinkDto]] = None
    otel: typing.Optional[OTelExtraDto] = None
    nodes: typing.Optional[
        typing.Dict[str, typing.Optional["SpanDtoNodesValue"]]
    ] = 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


from .span_dto_nodes_value import SpanDtoNodesValue  # noqa: E402, F401, I001

update_forward_refs(SpanDto)
