{
  "lexicon": 1,
  "id": "net.bisks.docmoot.snapshot",
  "defs": {
    "main": {
      "type": "record",
      "description": "A durable snapshot of a local docmoot draft, written to the owner's own repo via createRecord (PDS-assigned TID rkey) when they tap 'save snapshot to my PDS'. The live draft itself lives only in browser localStorage — this record is the only copy that survives clearing the browser or losing the device. Written and read by docmoot (https://docmoot.bisks.net).",
      "key": "tid",
      "record": {
        "type": "object",
        "required": ["docId", "title", "text", "url", "wordCount", "createdAt"],
        "properties": {
          "docId": {
            "type": "string",
            "maxLength": 64,
            "maxGraphemes": 32,
            "description": "The local draft's short id (10 characters from a fixed Crockford-ish alphabet, generated client-side with crypto.getRandomValues) — identifies which browser-local draft this snapshot was saved from, and is embedded in the shareable doc URL."
          },
          "title": {
            "type": "string",
            "maxLength": 1200,
            "maxGraphemes": 300,
            "description": "The document's title. No client-side length cap exists in the UI today, so this limit is a conservative guess rather than a mirrored constraint. Falls back to \"Untitled document\" if blank."
          },
          "text": {
            "type": "string",
            "maxLength": 400000,
            "maxGraphemes": 100000,
            "description": "The full document text, verbatim from the local textarea. No client-side length cap exists in the UI today (the draft is otherwise unbounded local text), so this limit is a conservative guess sized well above typical use — worth revisiting if long documents start getting rejected."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2000,
            "description": "The shareable docmoot URL for this draft at snapshot time (origin + mount + /d/<docId>)."
          },
          "wordCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Word count of text at snapshot time, computed client-side as text.trim().split(/\\s+/).length (0 if the draft is blank)."
          },
          "createdAt": {
            "type": "string",
            "format": "datetime",
            "description": "When this snapshot was saved, as an ISO 8601 datetime."
          }
        }
      }
    }
  }
}
