{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "ArgumentCondition": {
      "properties": {
        "index": {
          "type": "integer",
          "maximum": 65535,
          "minimum": 0
        },
        "equals": {
          "type": "string",
          "contentEncoding": "base64"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "index",
        "equals"
      ],
      "description": "ArgumentCondition requires the argument at Index (0 is the first argument after the predicate) to equal the canonical Ontos value Equals."
    },
    "Filter": {
      "properties": {
        "predicate": {
          "type": "string",
          "contentEncoding": "base64"
        },
        "arguments": {
          "items": {
            "$ref": "#/$defs/ArgumentCondition"
          },
          "type": "array"
        },
        "origin": {
          "type": "string",
          "enum": [
            "append",
            "create"
          ]
        },
        "positions": {
          "oneOf": [
            {
              "$ref": "#/$defs/PositionRange"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false,
      "type": "object",
      "description": "Filter is a conjunction of structural conditions compared by Ontos equality."
    },
    "PositionRange": {
      "properties": {
        "after": {
          "oneOf": [
            {
              "type": "integer",
              "maximum": 9007199254740991,
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "through": {
          "oneOf": [
            {
              "type": "integer",
              "maximum": 9007199254740991,
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false,
      "type": "object",
      "description": "PositionRange bounds a filter to positions in (After, Through]."
    },
    "Snapshot": {
      "properties": {
        "scope": {
          "$ref": "#/$defs/SpaceRef"
        },
        "max_depth": {
          "oneOf": [
            {
              "type": "integer",
              "maximum": 9007199254740991,
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "spaces": {
          "items": {
            "$ref": "#/$defs/SnapshotSpace"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "scope",
        "max_depth",
        "spaces"
      ],
      "description": "Snapshot is a recursively complete selection of journal prefixes under a scope, to a depth bound."
    },
    "SnapshotSpace": {
      "properties": {
        "space": {
          "$ref": "#/$defs/Space"
        },
        "through": {
          "type": "integer",
          "maximum": 9007199254740991,
          "minimum": 0
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "space",
        "through"
      ],
      "description": "SnapshotSpace is one covered space and the cutoff its facts were selected through."
    },
    "Space": {
      "properties": {
        "root_id": {
          "type": "string",
          "pattern": "^rt_[0-9a-f]{32}$"
        },
        "space_id": {
          "type": "string",
          "pattern": "^spc_[0-9a-f]{32}$"
        },
        "path": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "root_id",
        "space_id",
        "path"
      ],
      "description": "Space is a space's identity together with its path from the root."
    },
    "SpaceRef": {
      "properties": {
        "root_id": {
          "type": "string",
          "pattern": "^rt_[0-9a-f]{32}$"
        },
        "space_id": {
          "type": "string",
          "pattern": "^spc_[0-9a-f]{32}$"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "root_id",
        "space_id"
      ],
      "description": "SpaceRef is the exact identity of one continuing space and its journal."
    }
  },
  "properties": {
    "space": {
      "$ref": "#/$defs/SpaceRef"
    },
    "filter": {
      "oneOf": [
        {
          "$ref": "#/$defs/Filter"
        },
        {
          "type": "null"
        }
      ]
    },
    "max_depth": {
      "oneOf": [
        {
          "type": "integer",
          "maximum": 9007199254740991,
          "minimum": 0
        },
        {
          "type": "null"
        }
      ]
    },
    "snapshot": {
      "oneOf": [
        {
          "$ref": "#/$defs/Snapshot"
        },
        {
          "type": "null"
        }
      ]
    },
    "cursor": {
      "type": "string",
      "maxLength": 4096
    },
    "limit": {
      "type": "integer",
      "maximum": 128,
      "minimum": 0
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "space"
  ],
  "title": "QueryRequest",
  "description": "QueryRequest reads Space and its descendants over an explicit Snapshot, which the service captures when absent."
}
