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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .o_tel_context_dto import OTelContextDto
from .o_tel_event_dto import OTelEventDto
from .o_tel_link_dto import OTelLinkDto
from .o_tel_span_kind import OTelSpanKind
from .o_tel_status_code import OTelStatusCode


class OTelSpanDto(UniversalBaseModel):
    context: OTelContextDto
    name: str
    kind: typing.Optional[OTelSpanKind] = None
    start_time: dt.datetime
    end_time: dt.datetime
    status_code: typing.Optional[OTelStatusCode] = None
    status_message: typing.Optional[str] = None
    attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
    events: typing.Optional[typing.List[OTelEventDto]] = None
    parent: typing.Optional[OTelContextDto] = None
    links: typing.Optional[typing.List[OTelLinkDto]] = 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
