{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://standards.rootblocks.com/schemas/registry/schema-registry.index.v1.schema.json",
  "title": "RootBlocks Schema Registry Index v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "registryId", "version", "schemas"],
  "properties": {
    "schemaVersion": {
      "const": "rootblocks.schema-registry/v1"
    },
    "registryId": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9.-]{2,127}$"
    },
    "version": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[A-Za-z0-9.-]+)?(\\+[A-Za-z0-9.-]+)?$"
    },
    "schemas": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/schemaEntry"
      }
    }
  },
  "$defs": {
    "schemaEntry": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "domain",
        "artifactType",
        "version",
        "path",
        "compatibility"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "domain": {
          "enum": [
            "bundle",
            "registry",
            "construction",
            "semantic-engine",
            "project",
            "workflow",
            "component",
            "buildpack-project",
            "template",
            "regression",
            "source-map",
            "evidence",
            "infrastructure",
            "cicd",
            "testing-craft",
            "security",
            "compatibility",
            "cache",
            "distribution",
            "release",
            "organization",
            "extension",
            "audit",
            "architecture-profile",
            "structured-source",
            "source-audit",
            "recipe",
            "decision",
            "slice",
            "golden",
            "data",
            "observability-signal",
            "business-domain",
            "domain-evolution"
          ]
        },
        "artifactType": {
          "type": "string",
          "minLength": 1
        },
        "version": {
          "type": "string",
          "pattern": "^v[0-9]+$"
        },
        "path": {
          "type": "string",
          "pattern": "^schemas/.+\\.schema\\.json$"
        },
        "compatibility": {
          "enum": ["stable", "experimental", "deprecated"]
        },
        "validExamples": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "invalidExamples": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}
