# Generated by @typespec-fastapi/emitter
# Do not edit this file manually — regenerate with: tsp compile .
# This file contains Pydantic v2 models and enums generated from TypeSpec.
from __future__ import annotations

import datetime
from typing import Literal
from typing import Any
from pydantic import BaseModel, Field

class SessionRow(BaseModel):
    host: str
    tool: str
    session_id: str
    title: str
    working_directory: str
    model_name: str | None = Field(None)
    created_at: datetime.datetime | None = Field(None)
    last_activity_at: datetime.datetime | None = Field(None)
    message_count: int
    hidden: bool
    synced_at: datetime.datetime

class SessionDetail(BaseModel):
    host: str
    tool: str
    session_id: str
    title: str
    working_directory: str
    model_name: str | None = Field(None)
    created_at: datetime.datetime | None = Field(None)
    last_activity_at: datetime.datetime | None = Field(None)
    message_count: int
    hidden: bool
    synced_at: datetime.datetime
    messages: list[MessageRow]
    metadata: dict[str, Any]

class MessageRow(BaseModel):
    node_id: str
    parent_node_id: str | None = Field(None)
    message_id: str
    role: str
    content: str
    created_at: datetime.datetime | None = Field(None)
    metadata: dict[str, Any]

class MessageSearchResult(BaseModel):
    node_id: str
    parent_node_id: str | None = Field(None)
    message_id: str
    role: str
    content: str
    created_at: datetime.datetime | None = Field(None)
    metadata: dict[str, Any]
    session_id: str
    session_title: str
    session_host: str
    session_tool: str
    session_working_directory: str
    rank: float

class BackfillResult(BaseModel):
    backfilled: int

class SessionSearchResult(BaseModel):
    host: str
    tool: str
    session_id: str
    title: str
    working_directory: str
    model_name: str | None = Field(None)
    created_at: datetime.datetime | None = Field(None)
    last_activity_at: datetime.datetime | None = Field(None)
    message_count: int
    hidden: bool
    synced_at: datetime.datetime
    similarity: float
    matched_text: str

class HostStats(BaseModel):
    sessions: int
    messages: int
    last_sync: datetime.datetime | None = Field(None)

class ToolStats(BaseModel):
    sessions: int
    messages: int

class Stats(BaseModel):
    total_sessions: int
    total_messages: int
    by_host: dict[str, HostStats]
    by_tool: dict[str, ToolStats]
    oldest_session: datetime.datetime | None = Field(None)
    newest_session: datetime.datetime | None = Field(None)

class HostInfo(BaseModel):
    host: str
    last_sync: datetime.datetime | None = Field(None)
    session_count: int
    message_count: int

class HealthStatus(BaseModel):
    status: Literal["ok"]
