{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.ferretlang.org/registry/artifact/category-index/v1.json",
  "title": "Ferret Registry Category Index Artifact v1",
  "description": "The compact category discovery index in a generated Ferret Registry distribution.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "categories"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "categories": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "$ref": "#/$defs/categoryReference"
      }
    }
  },
  "$defs": {
    "categoryReference": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "count",
        "href"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/categoryID"
        },
        "name": {
          "$ref": "#/$defs/categoryName"
        },
        "count": {
          "type": "integer",
          "minimum": 0
        },
        "href": {
          "type": "string",
          "minLength": 1,
          "format": "uri-reference",
          "pattern": "^[^?#\\r\\n]+$"
        }
      }
    },
    "categoryID": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
    },
    "categoryName": {
      "type": "string",
      "minLength": 1,
      "pattern": "^[^\\r\\n]+$"
    }
  }
}
