{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/CreateHookRequestContent",
  "title": "CreateHookRequestContent",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "name",
    "script",
    "triggerId"
  ],
  "properties": {
    "name": {
      "type": "string",
      "description": "Name of this hook.",
      "default": "my-hook",
      "pattern": "^[a-zA-Z0-9]([ \\-a-zA-Z0-9]*[a-zA-Z0-9])?$"
    },
    "script": {
      "type": "string",
      "description": "Code to be executed when this hook runs.",
      "default": "module.exports = function(client, scope, audience, context, cb) cb(null, access_token); };",
      "minLength": 1
    },
    "enabled": {
      "type": "boolean",
      "description": "Whether this hook will be executed (true) or ignored (false).",
      "default": false
    },
    "dependencies": {
      "$ref": "#/components/schemas/HookDependencies"
    },
    "triggerId": {
      "$ref": "#/components/schemas/HookTriggerIdEnum",
      "description": "Execution stage of this rule. Can be `credentials-exchange`, `pre-user-registration`, `post-user-registration`, `post-change-password`, or `send-phone-message`."
    }
  }
}