{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://redbook.fun/specification/1.0/schemas/action-descriptor.schema.json",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1
    },
    "description": {
      "type": "string"
    },
    "effect": {
      "enum": [
        "read",
        "write",
        "external"
      ]
    },
    "inputSchema": {
      "type": "object"
    },
    "outputSchema": {
      "type": "object"
    },
    "modes": {
      "type": "array",
      "items": {
        "enum": [
          "reader-admin",
          "redbook-admin",
          "digital"
        ]
      }
    },
    "requirements": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "capability": {
      "type": "string",
      "minLength": 1
    },
    "available": {
      "type": "boolean"
    },
    "unavailableReason": {
      "type": "string"
    },
    "policyContextResolver": {
      "type": "string",
      "minLength": 1
    }
  },
  "required": [
    "name",
    "description",
    "effect",
    "inputSchema",
    "outputSchema",
    "modes",
    "requirements",
    "capability",
    "available"
  ],
  "additionalProperties": false,
  "allOf": [
    {
      "if": {
        "properties": {
          "available": {
            "const": false
          }
        }
      },
      "then": {
        "required": [
          "unavailableReason"
        ]
      }
    }
  ]
}
