{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/divinci-app/json-schema/divinci-app-thread-schema.json",
  "title": "Thread",
  "x-generated": "2026-11-06",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/divinci-app-api-openapi.yml#/components/schemas/Thread",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "title": {
      "type": [
        "string",
        "null"
      ]
    },
    "messageCount": {
      "type": "integer"
    },
    "lastMessageAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "messages": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Message"
      },
      "description": "Included when fetching a single thread"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "Message": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "transcriptId": {
          "type": "string"
        },
        "role": {
          "type": "string",
          "enum": [
            "user",
            "assistant",
            "system"
          ]
        },
        "content": {
          "type": "string"
        },
        "metadata": {
          "type": "object",
          "additionalProperties": true
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  }
}