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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class ThreadResponse(UniversalBaseModel):
    """
    Response schema for thread.
    """

    id: str = pydantic.Field()
    """
    Thread ID with thread_ prefix
    """

    object: typing.Optional[str] = pydantic.Field(default=None)
    """
    Object type, always 'thread'
    """

    created_at: str = pydantic.Field()
    """
    ISO 8601 datetime of creation
    """

    updated_at: str = pydantic.Field()
    """
    ISO 8601 datetime of last update
    """

    last_message_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    ISO 8601 datetime of last message activity
    """

    metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
    """
    Custom key-value pairs
    """

    assistant_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Bound assistant ID
    """

    organization_id: str = pydantic.Field()
    """
    Organization ID
    """

    user_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Creator user ID
    """

    title: typing.Optional[str] = pydantic.Field(default=None)
    """
    Thread title
    """

    status: typing.Optional[str] = pydantic.Field(default=None)
    """
    Streaming status (streaming or inactive)
    """

    message_count: int = pydantic.Field()
    """
    Total number of messages
    """

    visible_in_ui: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether this thread should be visible in the user interface
    """

    last_model_used: typing.Optional[str] = pydantic.Field(default=None)
    """
    Model used for the last message in this thread
    """

    is_pinned: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether this thread is pinned by the user
    """

    pinned_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    ISO 8601 datetime when thread was pinned
    """

    space_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    IDs of spaces this thread belongs to
    """

    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
