{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cheeleong.dev/wwn-system-json/systems/system.schema.json",
  "title": "Worlds Without Number System Data",
  "type": "object",
  "properties": {
    "@context": { "type": ["string", "object", "array"] },
    "@id": { "type": "string", "format": "uri" },
    "@type": { "const": "WWNSystemData" },
    "version": { "type": "string", "minLength": 1 },
    "metadata": {
      "type": "object",
      "properties": {
        "title": { "type": "string", "minLength": 1 },
        "author": { "type": "string", "minLength": 1 },
        "srdVersion": { "type": "string", "minLength": 1 },
        "license": { "type": "string", "minLength": 1 },
        "licenseUrl": { "type": "string", "format": "uri" },
        "source": { "$ref": "https://cheeleong.dev/wwn-system-json/systems/common.schema.json#/$defs/NodeReference" },
        "generatedAt": { "type": "string", "format": "date-time" },
        "contentDigest": { "type": "string", "pattern": "^sha256-[A-Fa-f0-9]{64}$" },
        "corpusDigest": { "type": "string", "pattern": "^sha256-[A-Fa-f0-9]{64}$" }
      },
      "required": ["title", "author", "srdVersion", "license", "licenseUrl", "source"],
      "unevaluatedProperties": false
    },
    "collections": {
      "type": "object",
      "patternProperties": {
        "^[a-z][a-z0-9-]*$": {
          "type": "array",
          "items": { "$ref": "https://cheeleong.dev/wwn-system-json/systems/common.schema.json#/$defs/NodeReference" },
          "uniqueItems": true,
          "minItems": 0
        }
      },
      "additionalProperties": false
    },
    "collectionSchemas": {
      "type": "object",
      "patternProperties": {
        "^[a-z][a-z0-9-]*$": { "type": "string", "format": "uri", "pattern": "^https?://" }
      },
      "additionalProperties": false,
      "minProperties": 1
    }
  },
  "required": ["@context", "@id", "@type", "version", "metadata", "collections", "collectionSchemas"],
  "unevaluatedProperties": false
}
