{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/okareo/json-schema/okareo-chat-session-messages-response-schema.json",
  "title": "ChatSessionMessagesResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/okareo-chat-api-openapi.yml#/components/schemas/ChatSessionMessagesResponse",
  "properties": {
    "session_id": {
      "type": "string",
      "format": "uuid",
      "title": "Session Id"
    },
    "messages": {
      "items": {
        "$ref": "#/$defs/ChatMessageResponse"
      },
      "type": "array",
      "title": "Messages"
    },
    "tool_calls": {
      "items": {
        "$ref": "#/$defs/ChatToolCallResponse-Output"
      },
      "type": "array",
      "title": "Tool Calls"
    }
  },
  "type": "object",
  "required": [
    "session_id",
    "messages",
    "tool_calls"
  ],
  "$defs": {
    "AnalyticsFilter": {
      "properties": {
        "member": {
          "type": "string",
          "title": "Member"
        },
        "operator": {
          "$ref": "#/$defs/ComparisonOperator",
          "default": "equal"
        },
        "values": {
          "items": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "string",
                "format": "uuid"
              }
            ]
          },
          "type": "array",
          "title": "Values"
        }
      },
      "type": "object",
      "required": [
        "member"
      ],
      "title": "AnalyticsFilter"
    },
    "AnalyticsFilterGroup-Output": {
      "properties": {
        "op": {
          "type": "string",
          "enum": [
            "and",
            "or"
          ],
          "title": "Op"
        },
        "filters": {
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/AnalyticsFilter"
              },
              {
                "$ref": "#/$defs/AnalyticsFilterGroup-Output"
              }
            ]
          },
          "type": "array",
          "minItems": 1,
          "title": "Filters"
        }
      },
      "type": "object",
      "required": [
        "op",
        "filters"
      ],
      "title": "AnalyticsFilterGroup"
    },
    "ChatMessageResponse": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id"
        },
        "session_id": {
          "type": "string",
          "format": "uuid",
          "title": "Session Id"
        },
        "sequence_number": {
          "type": "integer",
          "title": "Sequence Number"
        },
        "role": {
          "$ref": "#/$defs/ChatMessageRole"
        },
        "content": {
          "additionalProperties": true,
          "type": "object",
          "title": "Content"
        },
        "tool_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Tool Name"
        },
        "tool_call_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Tool Call Id"
        },
        "status": {
          "$ref": "#/$defs/ChatMessageStatus"
        },
        "time_created": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Time Created"
        }
      },
      "type": "object",
      "required": [
        "id",
        "session_id",
        "sequence_number",
        "role",
        "content",
        "status"
      ],
      "title": "ChatMessageResponse"
    },
    "ChatMessageRole": {
      "type": "string",
      "enum": [
        "user",
        "assistant",
        "tool"
      ],
      "title": "ChatMessageRole"
    },
    "ChatMessageStatus": {
      "type": "string",
      "enum": [
        "started",
        "completed",
        "errored"
      ],
      "title": "ChatMessageStatus"
    },
    "ChatToolCallResponse-Output": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id"
        },
        "session_id": {
          "type": "string",
          "format": "uuid",
          "title": "Session Id"
        },
        "message_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Message Id"
        },
        "sequence_number": {
          "type": "integer",
          "title": "Sequence Number"
        },
        "tool_name": {
          "type": "string",
          "title": "Tool Name"
        },
        "tool_args": {
          "additionalProperties": true,
          "type": "object",
          "title": "Tool Args"
        },
        "tool_result": {
          "anyOf": [
            {},
            {
              "type": "null"
            }
          ],
          "title": "Tool Result"
        },
        "request": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Request"
        },
        "response": {
          "anyOf": [
            {},
            {
              "type": "null"
            }
          ],
          "title": "Response"
        },
        "resulting_state": {
          "anyOf": [
            {
              "$ref": "#/$defs/PanelConfig-Output"
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "$ref": "#/$defs/ChatToolCallStatus"
        },
        "error_message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error Message"
        },
        "time_created": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Time Created"
        },
        "time_completed": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Time Completed"
        }
      },
      "type": "object",
      "required": [
        "id",
        "session_id",
        "sequence_number",
        "tool_name",
        "tool_args",
        "status"
      ],
      "title": "ChatToolCallResponse"
    },
    "ChatToolCallStatus": {
      "type": "string",
      "enum": [
        "started",
        "completed",
        "errored"
      ],
      "title": "ChatToolCallStatus"
    },
    "ComparisonOperator": {
      "type": "string",
      "enum": [
        "equal",
        "not_equal",
        "contains",
        "not_contains",
        "greater_than",
        "greater_than_or_equal",
        "less_than",
        "less_than_or_equal",
        "is_set",
        "not_set"
      ],
      "title": "ComparisonOperator"
    },
    "PanelConfig-Output": {
      "properties": {
        "id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Id"
        },
        "title": {
          "type": "string",
          "maxLength": 255,
          "minLength": 1,
          "title": "Title"
        },
        "chart_type": {
          "type": "string",
          "enum": [
            "line",
            "bar",
            "composed",
            "area",
            "radar",
            "stat",
            "table"
          ],
          "title": "Chart Type"
        },
        "query": {
          "$ref": "#/$defs/PanelQuery-Output"
        },
        "table_config": {
          "anyOf": [
            {
              "$ref": "#/$defs/PanelTableConfig"
            },
            {
              "type": "null"
            }
          ]
        },
        "layout": {
          "$ref": "#/$defs/PanelLayout"
        }
      },
      "type": "object",
      "required": [
        "title",
        "chart_type",
        "query",
        "layout"
      ],
      "title": "PanelConfig"
    },
    "PanelLayout": {
      "properties": {
        "x": {
          "type": "integer",
          "minimum": 0.0,
          "title": "X"
        },
        "y": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Y"
        },
        "w": {
          "type": "integer",
          "minimum": 1.0,
          "title": "W"
        },
        "h": {
          "type": "integer",
          "minimum": 1.0,
          "title": "H"
        }
      },
      "type": "object",
      "required": [
        "x",
        "y",
        "w",
        "h"
      ],
      "title": "PanelLayout"
    },
    "PanelQuery-Output": {
      "properties": {
        "cube": {
          "type": "string",
          "title": "Cube",
          "default": "check_trend"
        },
        "measures": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Measures"
        },
        "dimensions": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Dimensions"
        },
        "filters": {
          "items": {
            "anyOf": [
              {
                "$ref": "#/$defs/AnalyticsFilter"
              },
              {
                "$ref": "#/$defs/AnalyticsFilterGroup-Output"
              }
            ]
          },
          "type": "array",
          "title": "Filters"
        },
        "segments": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Segments"
        },
        "time_dimensions": {
          "items": {
            "$ref": "#/$defs/TimeDimension"
          },
          "type": "array",
          "title": "Time Dimensions"
        },
        "order": {
          "additionalProperties": {
            "type": "string",
            "enum": [
              "asc",
              "desc"
            ]
          },
          "type": "object",
          "title": "Order"
        }
      },
      "type": "object",
      "required": [
        "measures"
      ],
      "title": "PanelQuery",
      "description": "Query template stored per panel.\n\nDoes NOT include project_id.  ``time_range`` is injected by the frontend\nfrom the dashboard context and global time picker. Panels may include\noptional ``time_dimensions`` and ``order`` for Cube-style query shape."
    },
    "PanelTableConfig": {
      "properties": {
        "mode": {
          "type": "string",
          "enum": [
            "flat",
            "pivot"
          ],
          "title": "Mode",
          "default": "flat"
        },
        "row_dimensions": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Row Dimensions"
        },
        "column_dimension": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Column Dimension"
        },
        "value_measure": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Value Measure"
        }
      },
      "type": "object",
      "title": "PanelTableConfig"
    },
    "TimeDimension": {
      "properties": {
        "dimension": {
          "type": "string",
          "title": "Dimension"
        },
        "date_range": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array",
              "maxItems": 2,
              "minItems": 2
            },
            {
              "type": "null"
            }
          ],
          "title": "Date Range"
        },
        "granularity": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Granularity"
        }
      },
      "type": "object",
      "required": [
        "dimension"
      ],
      "title": "TimeDimension"
    }
  }
}