{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/pipeline-designer/pipeline-designer.github.io/main/schemas/registry.schema.json",
  "title": "Agent Pipeline Designer Registry",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "packages"],
  "properties": {
    "$schema": { "type": "string" },
    "schemaVersion": { "const": 1 },
    "packages": {
      "type": "array",
      "items": { "$ref": "#/$defs/package" }
    }
  },
  "$defs": {
    "package": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "description",
        "version",
        "author",
        "categories",
        "manifestUrl",
        "repository",
        "featured"
      ],
      "properties": {
        "id": {
          "type": "string",
          "maxLength": 128,
          "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)+$"
        },
        "name": { "type": "string", "minLength": 2, "maxLength": 80 },
        "description": {
          "type": "string",
          "minLength": 10,
          "maxLength": 300
        },
        "version": {
          "type": "string",
          "maxLength": 100,
          "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
        },
        "author": { "type": "string", "minLength": 2, "maxLength": 100 },
        "categories": {
          "type": "array",
          "maxItems": 12,
          "uniqueItems": true,
          "items": { "type": "string", "minLength": 2, "maxLength": 40 }
        },
        "manifestUrl": {
          "type": "string",
          "minLength": 10,
          "maxLength": 1000,
          "format": "uri",
          "pattern": "^https://(?:github\\.com|raw\\.githubusercontent\\.com)/"
        },
        "repository": {
          "type": "string",
          "minLength": 10,
          "maxLength": 500,
          "format": "uri",
          "pattern": "^https://(?:github\\.com|raw\\.githubusercontent\\.com)/"
        },
        "featured": { "type": "boolean" }
      }
    }
  }
}
