{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://redbook.fun/specification/1.0/schemas/hook-descriptor.schema.json",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1
    },
    "version": {
      "type": "string",
      "minLength": 1
    },
    "scope": {
      "enum": [
        "reader",
        "redbook",
        "viewbox"
      ]
    },
    "kind": {
      "enum": [
        "action",
        "filter"
      ]
    },
    "phase": {
      "enum": [
        "precommit",
        "postcommit",
        "query",
        "render",
        "lifecycle-before",
        "lifecycle-after"
      ]
    },
    "argumentsSchema": {
      "type": "object"
    },
    "resultSchema": {
      "oneOf": [
        {
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "description": {
      "type": "string"
    },
    "requires": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true
    }
  },
  "required": [
    "name",
    "version",
    "scope",
    "kind",
    "phase",
    "argumentsSchema",
    "resultSchema",
    "description",
    "requires"
  ],
  "additionalProperties": false
}
