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

from __future__ import annotations

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import (
    IS_PYDANTIC_V2,
    UniversalBaseModel,
    update_forward_refs,
)
from .o_tel_event import OTelEvent
from .o_tel_flat_span_output_end_time import OTelFlatSpanOutputEndTime
from .o_tel_flat_span_output_start_time import OTelFlatSpanOutputStartTime
from .o_tel_link import OTelLink
from .o_tel_span_kind import OTelSpanKind
from .o_tel_status_code import OTelStatusCode


class OTelFlatSpan(UniversalBaseModel):
    created_at: typing.Optional[dt.datetime] = None
    updated_at: typing.Optional[dt.datetime] = None
    deleted_at: typing.Optional[dt.datetime] = None
    created_by_id: typing.Optional[str] = None
    updated_by_id: typing.Optional[str] = None
    deleted_by_id: typing.Optional[str] = None
    trace_id: str
    span_id: str
    parent_id: typing.Optional[str] = None
    span_kind: typing.Optional[OTelSpanKind] = None
    span_name: typing.Optional[str] = None
    start_time: typing.Optional[OTelFlatSpanOutputStartTime] = None
    end_time: typing.Optional[OTelFlatSpanOutputEndTime] = None
    status_code: typing.Optional[OTelStatusCode] = None
    status_message: typing.Optional[str] = None
    attributes: typing.Optional[
        typing.Dict[str, typing.Optional["FullJsonOutput"]]
    ] = None
    events: typing.Optional[typing.List[OTelEvent]] = None
    links: typing.Optional[typing.List[OTelLink]] = 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 .full_json_output import FullJsonOutput  # noqa: E402, F401, I001

update_forward_refs(OTelFlatSpan)
