{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.orbiplex.dev/capability-registry.v1.schema.json",
  "title": "Capability Registry v1",
  "type": "object",
  "required": ["schema/v", "entries"],
  "additionalProperties": false,
  "properties": {
    "schema/v": { "const": "capability-registry.v1" },
    "entries": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/entry" }
    }
  },
  "$defs": {
    "entry": {
      "type": "object",
      "required": [
        "capability/id",
        "owner",
        "surfaces",
        "wire/name",
        "status",
        "flags"
      ],
      "additionalProperties": false,
      "properties": {
        "capability/id": {
          "type": "string",
          "minLength": 1,
          "description": "Canonical capability id. Semantic grammar is enforced by the registry parser."
        },
        "owner": { "type": "string", "minLength": 1 },
        "surfaces": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": { "enum": ["federated", "host-local"] }
        },
        "wire/name": {
          "type": "string",
          "pattern": "^(app|core|host|plugin|proof|role|sensorium|sovereign)/[^\\s]+$"
        },
        "status": { "enum": ["active", "deprecated", "reserved"] },
        "flags": { "$ref": "#/$defs/flags" },
        "docs": { "$ref": "#/$defs/docs" },
        "notes": { "type": "string", "minLength": 1 }
      }
    },
    "flags": {
      "type": "object",
      "required": [
        "dispatchable",
        "advertisable",
        "passport/eligible",
        "signing-domain",
        "host-route",
        "federated-discovery"
      ],
      "additionalProperties": false,
      "properties": {
        "dispatchable": { "type": "boolean" },
        "advertisable": { "type": "boolean" },
        "passport/eligible": { "type": "boolean" },
        "signing-domain": { "type": "boolean" },
        "host-route": { "type": "boolean" },
        "federated-discovery": { "type": "boolean" }
      }
    },
    "docs": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "human-registry": { "type": "boolean" }
      }
    }
  }
}
