# 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 .error_info_write import ErrorInfoWrite
from .json_list_string_write import JsonListStringWrite
from .json_node_write import JsonNodeWrite


class TraceWrite(UniversalBaseModel):
    id: typing.Optional[str] = None
    project_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    If null, the default project is used
    """

    name: typing.Optional[str] = None
    start_time: dt.datetime
    end_time: typing.Optional[dt.datetime] = None
    input: typing.Optional[JsonListStringWrite] = None
    output: typing.Optional[JsonListStringWrite] = None
    metadata: typing.Optional[JsonNodeWrite] = None
    tags: typing.Optional[typing.List[str]] = None
    error_info: typing.Optional[ErrorInfoWrite] = None
    last_updated_at: typing.Optional[dt.datetime] = None
    thread_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
