{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.bitcoinuniverse.dev/witc/v1/context-manifest.schema.json",
  "title": "Witness Circles context manifest",
  "$comment": "String limits count Unicode code points. Semantic validation also requires well-formed Unicode, strings unchanged by ECMAScript TrimString, no Unicode normalization before JCS, real UTC calendar timestamps, expires later than created, and unique alias keys.",
  "type": "object",
  "additionalProperties": false,
  "required": ["protocol", "version", "kind", "nonce", "title", "created", "expires"],
  "properties": {
    "protocol": { "const": "witc" },
    "version": { "const": 1 },
    "kind": { "const": "circle" },
    "nonce": { "type": "string", "pattern": "^[0-9a-f]{32}$" },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120,
      "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
    },
    "created": {
      "type": "string",
      "format": "date-time",
      "minLength": 20,
      "maxLength": 24,
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?Z$"
    },
    "expires": {
      "type": "string",
      "format": "date-time",
      "minLength": 20,
      "maxLength": 24,
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,3})?Z$"
    },
    "orbit": {
      "type": "string",
      "minLength": 1,
      "maxLength": 96,
      "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
    },
    "host": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
    },
    "media": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
    },
    "renderer": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
    },
    "aliases": {
      "type": "array",
      "maxItems": 16,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["key", "label"],
        "properties": {
          "key": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 48,
            "pattern": "^\\S(?:[\\s\\S]*\\S)?$"
          }
        }
      }
    }
  }
}
