# 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 .comment import Comment
from .feedback_score import FeedbackScore
from .json_node import JsonNode
from .trace_thread_status import TraceThreadStatus


class TraceThread(UniversalBaseModel):
    id: typing.Optional[str] = None
    project_id: typing.Optional[str] = None
    thread_model_id: typing.Optional[str] = None
    start_time: typing.Optional[dt.datetime] = None
    end_time: typing.Optional[dt.datetime] = None
    duration: typing.Optional[float] = None
    first_message: typing.Optional[JsonNode] = None
    last_message: typing.Optional[JsonNode] = None
    feedback_scores: typing.Optional[typing.List[FeedbackScore]] = None
    status: typing.Optional[TraceThreadStatus] = None
    number_of_messages: typing.Optional[int] = None
    total_estimated_cost: typing.Optional[float] = None
    usage: typing.Optional[typing.Dict[str, int]] = None
    comments: typing.Optional[typing.List[Comment]] = None
    tags: typing.Optional[typing.List[str]] = None
    last_updated_at: typing.Optional[dt.datetime] = None
    last_updated_by: typing.Optional[str] = None
    created_by: typing.Optional[str] = None
    created_at: typing.Optional[dt.datetime] = 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
