{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.ferretlang.org/registry/artifact/root/v1.json",
  "title": "Ferret Registry Root Artifact v1",
  "description": "The discovery entry point for a generated Ferret Registry distribution.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "source",
    "artifacts"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "source": {
      "$ref": "#/$defs/source"
    },
    "artifacts": {
      "type": "object",
      "required": [
        "categories",
        "modules",
        "plugins"
      ],
      "propertyNames": {
        "pattern": "^[a-z][a-z0-9-]*$"
      },
      "properties": {
        "categories": {
          "$ref": "#/$defs/artifactReference"
        },
        "modules": {
          "$ref": "#/$defs/artifactReference"
        },
        "plugins": {
          "$ref": "#/$defs/artifactReference"
        }
      },
      "additionalProperties": {
        "$ref": "#/$defs/artifactReference"
      }
    }
  },
  "$defs": {
    "source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "commit"
      ],
      "properties": {
        "commit": {
          "type": "string",
          "pattern": "^([0-9a-f]{40}|[0-9a-f]{64})$"
        }
      }
    },
    "artifactReference": {
      "type": "string",
      "minLength": 1,
      "format": "uri-reference",
      "pattern": "^[^?#\\r\\n]+$"
    }
  }
}
