{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "gno://schemas/multi-get@1.0",
  "title": "GNO Multi-Get Response",
  "description": "Response from gno multi-get command",
  "type": "object",
  "required": ["documents", "meta"],
  "properties": {
    "documents": {
      "type": "array",
      "description": "Retrieved documents",
      "items": {
        "type": "object",
        "required": ["docid", "uri", "content", "source"],
        "properties": {
          "docid": {
            "type": "string",
            "pattern": "^#[a-f0-9]{6,8}$"
          },
          "uri": {
            "type": "string",
            "pattern": "^gno://[^/]+/.+"
          },
          "title": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "description": "Mirror content (possibly truncated)"
          },
          "truncated": {
            "type": "boolean",
            "description": "Whether content was truncated due to maxBytes"
          },
          "totalLines": {
            "type": "integer",
            "minimum": 0
          },
          "source": {
            "type": "object",
            "required": ["relPath", "mime", "ext"],
            "properties": {
              "absPath": { "type": "string" },
              "relPath": { "type": "string" },
              "mime": { "type": "string" },
              "ext": { "type": "string", "pattern": "^\\.[a-zA-Z0-9]+$" }
            }
          },
          "record": {
            "type": "object",
            "additionalProperties": false,
            "description": "Bounded logical-record provenance for a file/export source",
            "required": ["recordKey", "sourceLocator", "anchors", "adapter"],
            "properties": {
              "recordKey": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
              "sourceLocator": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              "anchors": {
                "type": "array",
                "maxItems": 256,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": ["kind", "value"],
                  "properties": {
                    "kind": {
                      "enum": [
                        "line",
                        "cue",
                        "timestamp",
                        "message",
                        "event",
                        "record"
                      ]
                    },
                    "value": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "endValue": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    }
                  }
                }
              },
              "adapter": {
                "type": "object",
                "additionalProperties": false,
                "required": ["id", "version", "fingerprint"],
                "properties": {
                  "id": { "type": "string", "minLength": 1, "maxLength": 128 },
                  "version": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "fingerprint": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                }
              },
              "author": { "type": "string", "maxLength": 2048 },
              "participants": {
                "type": "array",
                "maxItems": 256,
                "items": { "type": "string", "minLength": 1, "maxLength": 2048 }
              },
              "categories": {
                "type": "array",
                "maxItems": 256,
                "items": { "type": "string", "minLength": 1, "maxLength": 512 }
              },
              "dateFields": {
                "type": "object",
                "maxProperties": 256,
                "propertyNames": { "type": "string", "maxLength": 128 },
                "additionalProperties": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                }
              },
              "messageId": { "type": "string", "maxLength": 2048 },
              "inReplyTo": { "type": "string", "maxLength": 2048 },
              "references": {
                "type": "array",
                "maxItems": 256,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 2048
                }
              },
              "threadId": { "type": "string", "maxLength": 2048 },
              "eventId": { "type": "string", "maxLength": 2048 },
              "sessionId": { "type": "string", "maxLength": 2048 },
              "attachments": {
                "type": "array",
                "maxItems": 256,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": ["name"],
                  "properties": {
                    "name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    },
                    "mime": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 256
                    },
                    "bytes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "disposition": { "enum": ["inline", "attachment"] },
                    "sha256": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "skipped": {
      "type": "array",
      "description": "Documents that were skipped",
      "items": {
        "type": "object",
        "required": ["ref", "reason"],
        "properties": {
          "ref": {
            "type": "string",
            "description": "Requested reference"
          },
          "reason": {
            "type": "string",
            "description": "Reason for skipping",
            "enum": [
              "not_found",
              "exceeds_maxBytes",
              "permission_denied",
              "conversion_error",
              "invalid_ref"
            ]
          }
        }
      }
    },
    "meta": {
      "type": "object",
      "required": ["requested", "returned", "skipped"],
      "properties": {
        "requested": {
          "type": "integer",
          "description": "Number of documents requested",
          "minimum": 0
        },
        "returned": {
          "type": "integer",
          "description": "Number of documents returned",
          "minimum": 0
        },
        "skipped": {
          "type": "integer",
          "description": "Number of documents skipped",
          "minimum": 0
        },
        "maxBytes": {
          "type": "integer",
          "description": "Max bytes limit used"
        }
      }
    }
  }
}
