{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://quickiso.app/data-portability/tables/ai_chat_messages.schema.json",
  "title": "tables/ai_chat_messages.json",
  "description": "The rows of the table ai_chat_messages that belong to the workspace, one object per row, keyed by the database's column names.",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "uuid"
      },
      "organization_id": {
        "type": "string",
        "format": "uuid"
      },
      "thread_id": {
        "type": "string",
        "format": "uuid"
      },
      "role": {
        "type": "string",
        "enum": [
          "person",
          "assistant"
        ]
      },
      "body": {
        "type": "string"
      },
      "outcome": {
        "type": [
          "string",
          "null"
        ]
      },
      "confidence": {
        "type": [
          "string",
          "null"
        ]
      },
      "error_code": {
        "type": [
          "string",
          "null"
        ]
      },
      "citations": {
        "type": [
          "object",
          "array",
          "string",
          "number",
          "boolean",
          "null"
        ]
      },
      "suspicious": {
        "type": "boolean"
      },
      "questionnaire_id": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "provider": {
        "type": [
          "string",
          "null"
        ],
        "enum": [
          "openai",
          "anthropic",
          "gemini",
          "own",
          null
        ]
      },
      "model": {
        "type": [
          "string",
          "null"
        ]
      },
      "input_tokens": {
        "type": "integer"
      },
      "output_tokens": {
        "type": "integer"
      },
      "created_by": {
        "type": [
          "string",
          "null"
        ],
        "format": "uuid"
      },
      "created_at": {
        "type": "string",
        "format": "date-time",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
      }
    },
    "required": [
      "id",
      "organization_id",
      "thread_id",
      "role",
      "body",
      "outcome",
      "confidence",
      "error_code",
      "citations",
      "suspicious",
      "questionnaire_id",
      "provider",
      "model",
      "input_tokens",
      "output_tokens",
      "created_by",
      "created_at"
    ],
    "additionalProperties": false
  }
}
