{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "gno://schemas/get@1.0",
  "title": "GNO Get Response",
  "description": "Response from gno get command",
  "type": "object",
  "required": [
    "docid",
    "uri",
    "content",
    "totalLines",
    "source",
    "capabilities"
  ],
  "properties": {
    "docid": {
      "type": "string",
      "description": "Document ID",
      "pattern": "^#[a-f0-9]{6,8}$"
    },
    "uri": {
      "type": "string",
      "description": "Document URI",
      "pattern": "^gno://[^/]+/.+"
    },
    "title": {
      "type": "string",
      "description": "Extracted document title"
    },
    "content": {
      "type": "string",
      "description": "Mirror content (Markdown)"
    },
    "totalLines": {
      "type": "integer",
      "description": "Total lines in document",
      "minimum": 0
    },
    "returnedLines": {
      "type": "object",
      "description": "Line range returned (if partial)",
      "properties": {
        "start": {
          "type": "integer",
          "minimum": 1
        },
        "end": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": ["start", "end"]
    },
    "language": {
      "type": "string",
      "description": "Document language hint (BCP-47)"
    },
    "source": {
      "type": "object",
      "description": "Source file metadata",
      "required": ["relPath", "mime", "ext"],
      "properties": {
        "absPath": {
          "type": "string",
          "description": "Absolute path to source file"
        },
        "relPath": {
          "type": "string",
          "description": "Path relative to collection root"
        },
        "mime": {
          "type": "string",
          "description": "MIME type of source file"
        },
        "ext": {
          "type": "string",
          "description": "File extension",
          "pattern": "^\\.[a-zA-Z0-9]+$"
        },
        "modifiedAt": {
          "type": "string",
          "description": "Last modification time (ISO 8601)",
          "format": "date-time"
        },
        "sizeBytes": {
          "type": "integer",
          "description": "File size in bytes",
          "minimum": 0
        },
        "sourceHash": {
          "type": "string",
          "description": "SHA-256 hash of source file"
        }
      }
    },
    "conversion": {
      "type": "object",
      "description": "Conversion metadata",
      "properties": {
        "converterId": {
          "type": "string"
        },
        "converterVersion": {
          "type": "string"
        },
        "mirrorHash": {
          "type": "string"
        }
      }
    },
    "capabilities": {
      "type": "object",
      "required": [
        "editable",
        "tagsEditable",
        "tagsWriteback",
        "canCreateEditableCopy",
        "mode"
      ],
      "properties": {
        "editable": { "type": "boolean" },
        "tagsEditable": { "type": "boolean" },
        "tagsWriteback": { "type": "boolean" },
        "canCreateEditableCopy": { "type": "boolean" },
        "mode": {
          "type": "string",
          "enum": ["editable", "read_only"]
        },
        "reason": { "type": "string" }
      }
    },
    "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}$" }
            }
          }
        }
      }
    },
    "tags": {
      "type": "array",
      "description": "Tags associated with the document",
      "items": {
        "type": "string"
      }
    }
  }
}
