{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/useimmensity-com/json-schema/useimmensity-com-search-session-detail-schema.json",
  "title": "SearchSessionDetail",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/useimmensity-com-openapi.json#/components/schemas/SearchSessionDetail",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "title": {
      "type": "string",
      "title": "Title"
    },
    "saved": {
      "type": "boolean",
      "title": "Saved"
    },
    "archived": {
      "type": "boolean",
      "title": "Archived"
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expires At"
    },
    "last_activity_at": {
      "type": "string",
      "format": "date-time",
      "title": "Last Activity At"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At"
    },
    "turns": {
      "items": {
        "$ref": "#/$defs/SearchTurnResponse"
      },
      "type": "array",
      "title": "Turns"
    },
    "runs": {
      "items": {
        "$ref": "#/$defs/SearchRunResponse"
      },
      "type": "array",
      "title": "Runs"
    }
  },
  "type": "object",
  "required": [
    "id",
    "title",
    "saved",
    "archived",
    "expires_at",
    "last_activity_at",
    "created_at",
    "updated_at",
    "turns",
    "runs"
  ],
  "$defs": {
    "ClusterSearchQuery": {
      "properties": {
        "query": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500
            },
            {
              "type": "null"
            }
          ],
          "title": "Query"
        },
        "sources": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 20,
          "title": "Sources"
        },
        "communities": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 20,
          "title": "Communities"
        },
        "min_posts": {
          "type": "integer",
          "maximum": 100000.0,
          "minimum": 1.0,
          "title": "Min Posts",
          "default": 1
        },
        "observed_after": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Observed After"
        },
        "sort": {
          "type": "string",
          "enum": [
            "relevance",
            "newest",
            "largest"
          ],
          "title": "Sort",
          "default": "relevance"
        },
        "limit": {
          "type": "integer",
          "maximum": 50.0,
          "minimum": 1.0,
          "title": "Limit",
          "default": 20
        },
        "offset": {
          "type": "integer",
          "maximum": 1000000.0,
          "minimum": 0.0,
          "title": "Offset",
          "default": 0
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "ClusterSearchQuery",
      "description": "Allow-listed, deterministic cluster search inputs."
    },
    "SearchFilterOptions": {
      "properties": {
        "sources": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 100,
          "title": "Sources"
        },
        "communities": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 100,
          "title": "Communities"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "SearchFilterOptions",
      "description": "Canonical values currently present in the searchable dataset."
    },
    "SearchInterpretationResponse": {
      "properties": {
        "draft": {
          "$ref": "#/$defs/ClusterSearchQuery"
        },
        "confirmation": {
          "type": "string",
          "title": "Confirmation"
        },
        "assumptions": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Assumptions"
        },
        "unsupported": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Unsupported"
        },
        "clarification_question": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Clarification Question"
        },
        "needs_clarification": {
          "type": "boolean",
          "title": "Needs Clarification"
        },
        "needs_confirmation": {
          "type": "boolean",
          "title": "Needs Confirmation"
        },
        "fallback_used": {
          "type": "boolean",
          "title": "Fallback Used"
        },
        "available_options": {
          "$ref": "#/$defs/SearchFilterOptions"
        }
      },
      "type": "object",
      "required": [
        "draft",
        "confirmation",
        "assumptions",
        "unsupported",
        "clarification_question",
        "needs_clarification",
        "needs_confirmation",
        "fallback_used",
        "available_options"
      ],
      "title": "SearchInterpretationResponse",
      "description": "Frontend-ready confirmation state; this endpoint never runs the query."
    },
    "SearchRunResponse": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "draft": {
          "$ref": "#/$defs/ClusterSearchQuery"
        },
        "result_cluster_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Result Cluster Ids"
        },
        "result_count": {
          "type": "integer",
          "title": "Result Count"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        }
      },
      "type": "object",
      "required": [
        "id",
        "draft",
        "result_cluster_ids",
        "result_count",
        "created_at"
      ],
      "title": "SearchRunResponse"
    },
    "SearchTurnResponse": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "user_message": {
          "type": "string",
          "title": "User Message"
        },
        "interpretation": {
          "$ref": "#/$defs/SearchInterpretationResponse"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        }
      },
      "type": "object",
      "required": [
        "id",
        "user_message",
        "interpretation",
        "created_at"
      ],
      "title": "SearchTurnResponse"
    }
  }
}