{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://humble.team/schemas/playbook-catalog.schema.json",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "entries"],
  "properties": {
    "schemaVersion": { "const": "1.0.0" },
    "entries": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "version", "source", "sha256", "consumers", "provenance"],
        "properties": {
          "id": { "type": "string", "pattern": "^playbook\\.[a-z0-9][a-z0-9-]*$" },
          "version": { "type": "string", "minLength": 1 },
          "source": { "type": "string", "pattern": "^knowledgebase/playbooks/[a-z0-9-]+\\.md$" },
          "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
          "consumers": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
          "provenance": {
            "type": "object",
            "additionalProperties": false,
            "required": ["sourceId", "version", "verifiedAt", "derivation"],
            "properties": {
              "sourceId": { "type": "string", "minLength": 1 },
              "version": { "type": "string", "minLength": 1 },
              "verifiedAt": { "type": "string", "format": "date-time" },
              "derivation": { "enum": ["native", "adapted"] }
            }
          }
        }
      }
    }
  }
}

