{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/okareo/json-schema/okareo-chat-session-response-schema.json",
  "title": "ChatSessionResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/okareo-chat-api-openapi.yml#/components/schemas/ChatSessionResponse",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "title": "Id"
    },
    "organization_id": {
      "type": "string",
      "format": "uuid",
      "title": "Organization Id"
    },
    "project_id": {
      "type": "string",
      "format": "uuid",
      "title": "Project Id"
    },
    "dashboard_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Dashboard Id"
    },
    "agent": {
      "$ref": "#/$defs/ChatAgent"
    },
    "session_type": {
      "$ref": "#/$defs/ChatSessionType"
    },
    "status": {
      "$ref": "#/$defs/ChatSessionStatus"
    },
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Title"
    },
    "current_state": {
      "anyOf": [
        {
          "$ref": "#/$defs/PanelConfig-Output"
        },
        {
          "type": "null"
        }
      ]
    },
    "last_user_message_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last User Message At"
    },
    "last_agent_message_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Agent Message At"
    },
    "time_created": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Time Created"
    },
    "time_modified": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Time Modified"
    }
  },
  "type": "object",
  "required": [
    "id",
    "organization_id",
    "project_id",
    "agent",
    "session_type",
    "status"
  ],
  "$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"
    },
    "ChatAgent": {
      "type": "string",
      "enum": [
        "dashboard"
      ],
      "title": "ChatAgent"
    },
    "ChatSessionStatus": {
      "type": "string",
      "enum": [
        "active",
        "completed",
        "cancelled",
        "errored"
      ],
      "title": "ChatSessionStatus"
    },
    "ChatSessionType": {
      "type": "string",
      "enum": [
        "dashboard_panel_creation"
      ],
      "title": "ChatSessionType"
    },
    "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"
    }
  }
}