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

import typing

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


class ThreadListResponse(UniversalBaseModel):
    """
    Response schema for paginated thread list with cursor-based pagination.
    """

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

    data: typing.List[ThreadResponse] = pydantic.Field()
    """
    List of threads
    """

    first_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    First thread ID in results (cursor)
    """

    last_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Last thread ID in results (cursor)
    """

    has_more: bool = pydantic.Field()
    """
    Whether there are more results available
    """

    limit: int = pydantic.Field()
    """
    Maximum number of records returned
    """

    total: typing.Optional[int] = pydantic.Field(default=None)
    """
    Total count of threads matching filters. None if include_total=false (not computed). 0 if include_total=true and no threads exist.
    """

    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
