{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:orbiplex:schema:interaction-broker-watch:v1",
  "title": "Interaction Broker Watch v1",
  "description": "Cursor-bound watch request over one registered observation source.",
  "type": "object",
  "additionalProperties": false,
  "x-dia-workflow": "project",
  "x-dia-status": "draft",
  "x-dia-basis": [
    "doc/project/40-proposals/071-sensorium-workbench.md",
    "doc/project/60-solutions/035-interaction-broker/035-interaction-broker.md"
  ],
  "required": ["schema", "schema/v", "watch/ref", "idempotency/key", "source", "caps", "ttl_ms"],
  "properties": {
    "schema": { "const": "interaction-broker-watch.v1" },
    "schema/v": { "const": 1 },
    "watch/ref": { "$ref": "#/$defs/ref" },
    "correlation/id": { "$ref": "#/$defs/ref" },
    "idempotency/key": { "$ref": "#/$defs/ref" },
    "source": { "$ref": "#/$defs/observationSource" },
    "cursor": { "$ref": "#/$defs/watchCursor" },
    "caps": { "$ref": "#/$defs/watchCaps" },
    "ttl_ms": { "type": "integer", "minimum": 1, "maximum": 900000 }
  },
  "$defs": {
    "ref": { "type": "string", "minLength": 1, "not": { "pattern": "\\u0000" } },
    "watchCaps": {
      "type": "object",
      "additionalProperties": false,
      "required": ["events/max", "bytes/max"],
      "properties": {
        "events/max": { "type": "integer", "minimum": 1 },
        "bytes/max": { "type": "integer", "minimum": 1 }
      }
    },
    "watchCursor": {
      "type": "object",
      "additionalProperties": false,
      "required": ["cursor/value", "cursor/source"],
      "properties": {
        "cursor/value": { "$ref": "#/$defs/ref" },
        "cursor/source": { "$ref": "#/$defs/observationSource" }
      }
    },
    "observationSource": { "$ref": "interaction-broker-wait.request.v1.schema.json#/$defs/observationSource" }
  }
}
