{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "codeBlock": {
      "description": "A fenced code block",
      "properties": {
        "code": {
          "maxLength": 20000,
          "type": "string"
        },
        "lang": {
          "maxLength": 50,
          "type": "string"
        }
      },
      "required": [
        "code"
      ],
      "type": "object"
    },
    "heading": {
      "description": "A heading block (h1-h3) with optional inline formatting",
      "properties": {
        "facets": {
          "items": {
            "ref": "network.slices.tools.richtext.facet",
            "type": "ref"
          },
          "type": "array"
        },
        "level": {
          "maximum": 3,
          "minimum": 1,
          "type": "integer"
        },
        "text": {
          "maxLength": 300,
          "type": "string"
        }
      },
      "required": [
        "level",
        "text"
      ],
      "type": "object"
    },
    "imageEmbed": {
      "description": "An embedded image with alt text",
      "properties": {
        "alt": {
          "description": "Alt text for accessibility",
          "maxLength": 1000,
          "type": "string"
        },
        "image": {
          "accept": [
            "image/*"
          ],
          "maxSize": 1000000,
          "type": "blob"
        }
      },
      "required": [
        "image"
      ],
      "type": "object"
    },
    "main": {
      "key": "tid",
      "record": {
        "properties": {
          "blocks": {
            "description": "Document content as array of blocks",
            "items": {
              "refs": [
                "#paragraph",
                "#heading",
                "#codeBlock",
                "#quote",
                "#tangledEmbed",
                "#imageEmbed"
              ],
              "type": "union"
            },
            "type": "array"
          },
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "slug": {
            "description": "URL-friendly identifier, unique per author",
            "maxLength": 100,
            "type": "string"
          },
          "title": {
            "description": "Document title",
            "maxLength": 300,
            "type": "string"
          },
          "updatedAt": {
            "format": "datetime",
            "type": "string"
          }
        },
        "required": [
          "title",
          "slug",
          "blocks",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "paragraph": {
      "description": "A paragraph block with optional inline formatting",
      "properties": {
        "facets": {
          "items": {
            "ref": "network.slices.tools.richtext.facet",
            "type": "ref"
          },
          "type": "array"
        },
        "text": {
          "maxLength": 10000,
          "type": "string"
        }
      },
      "required": [
        "text"
      ],
      "type": "object"
    },
    "quote": {
      "description": "A blockquote with optional inline formatting",
      "properties": {
        "facets": {
          "items": {
            "ref": "network.slices.tools.richtext.facet",
            "type": "ref"
          },
          "type": "array"
        },
        "text": {
          "maxLength": 5000,
          "type": "string"
        }
      },
      "required": [
        "text"
      ],
      "type": "object"
    },
    "tangledEmbed": {
      "description": "An embedded Tangled repo card",
      "properties": {
        "handle": {
          "description": "The repo owner's handle",
          "maxLength": 300,
          "type": "string"
        },
        "repo": {
          "description": "The repository name",
          "maxLength": 300,
          "type": "string"
        }
      },
      "required": [
        "handle",
        "repo"
      ],
      "type": "object"
    }
  },
  "id": "network.slices.tools.document",
  "lexicon": 1
}
