{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "anyOf": [
    {
      "$ref": "#/definitions/SCPluginAdd"
    },
    {
      "$ref": "#/definitions/SCPluginRemove"
    }
  ],
  "description": "Plugin register request",
  "definitions": {
    "SCPluginAdd": {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "const": "add",
          "description": "The desired action, so whether the plugin should be added or removed"
        },
        "plugin": {
          "$ref": "#/definitions/SCPluginMetaData",
          "description": "Plugin information needed for its registration"
        }
      },
      "required": [
        "action",
        "plugin"
      ],
      "additionalProperties": false,
      "description": "Plugin request for adding a plugin registration to the backend"
    },
    "SCPluginMetaData": {
      "type": "object",
      "properties": {
        "address": {
          "type": "string",
          "description": "The address of the plugin, to which the backend routes the requests"
        },
        "name": {
          "type": "string",
          "description": "The name of the plugin (for debugging purposes, to more easily identify conflicts)"
        },
        "requestSchema": {
          "$ref": "#/definitions/JSONSchema7",
          "description": "How the requests of the plugin looks like, a JSON schema for validation"
        },
        "responseSchema": {
          "$ref": "#/definitions/JSONSchema7",
          "description": "How the responses of the plugin looks like, a JSON schema for validation"
        },
        "route": {
          "type": "string",
          "description": "The desired route, for example /feedback."
        }
      },
      "required": [
        "address",
        "name",
        "requestSchema",
        "responseSchema",
        "route"
      ],
      "additionalProperties": false,
      "description": "Plugin meta data - contains needed information for a plugin registration"
    },
    "JSONSchema7": {
      "type": "object",
      "properties": {
        "$id": {
          "type": "string"
        },
        "$ref": {
          "type": "string"
        },
        "$schema": {
          "$ref": "#/definitions/JSONSchema7Version"
        },
        "$comment": {
          "type": "string"
        },
        "$defs": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/JSONSchema7Definition"
          }
        },
        "type": {
          "anyOf": [
            {
              "$ref": "#/definitions/JSONSchema7TypeName"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/definitions/JSONSchema7TypeName"
              }
            }
          ]
        },
        "enum": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/JSONSchema7Type"
          }
        },
        "const": {
          "$ref": "#/definitions/JSONSchema7Type"
        },
        "multipleOf": {
          "type": "number"
        },
        "maximum": {
          "type": "number"
        },
        "exclusiveMaximum": {
          "type": "number"
        },
        "minimum": {
          "type": "number"
        },
        "exclusiveMinimum": {
          "type": "number"
        },
        "maxLength": {
          "type": "number"
        },
        "minLength": {
          "type": "number"
        },
        "pattern": {
          "type": "string"
        },
        "items": {
          "anyOf": [
            {
              "$ref": "#/definitions/JSONSchema7Definition"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/definitions/JSONSchema7Definition"
              }
            }
          ]
        },
        "additionalItems": {
          "$ref": "#/definitions/JSONSchema7Definition"
        },
        "maxItems": {
          "type": "number"
        },
        "minItems": {
          "type": "number"
        },
        "uniqueItems": {
          "type": "boolean"
        },
        "contains": {
          "$ref": "#/definitions/JSONSchema7Definition"
        },
        "maxProperties": {
          "type": "number"
        },
        "minProperties": {
          "type": "number"
        },
        "required": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "properties": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/JSONSchema7Definition"
          }
        },
        "patternProperties": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/JSONSchema7Definition"
          }
        },
        "additionalProperties": {
          "$ref": "#/definitions/JSONSchema7Definition"
        },
        "dependencies": {
          "type": "object",
          "additionalProperties": {
            "anyOf": [
              {
                "$ref": "#/definitions/JSONSchema7Definition"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          }
        },
        "propertyNames": {
          "$ref": "#/definitions/JSONSchema7Definition"
        },
        "if": {
          "$ref": "#/definitions/JSONSchema7Definition"
        },
        "then": {
          "$ref": "#/definitions/JSONSchema7Definition"
        },
        "else": {
          "$ref": "#/definitions/JSONSchema7Definition"
        },
        "allOf": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/JSONSchema7Definition"
          }
        },
        "anyOf": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/JSONSchema7Definition"
          }
        },
        "oneOf": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/JSONSchema7Definition"
          }
        },
        "not": {
          "$ref": "#/definitions/JSONSchema7Definition"
        },
        "format": {
          "type": "string"
        },
        "contentMediaType": {
          "type": "string"
        },
        "contentEncoding": {
          "type": "string"
        },
        "definitions": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/JSONSchema7Definition"
          }
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "default": {
          "$ref": "#/definitions/JSONSchema7Type"
        },
        "readOnly": {
          "type": "boolean"
        },
        "writeOnly": {
          "type": "boolean"
        },
        "examples": {
          "$ref": "#/definitions/JSONSchema7Type"
        }
      },
      "additionalProperties": false
    },
    "JSONSchema7Version": {
      "type": "string",
      "description": "Meta schema\n\nRecommended values:\n- 'http://json-schema.org/schema#'\n- 'http://json-schema.org/hyper-schema#'\n- 'http://json-schema.org/draft-07/schema#'\n- 'http://json-schema.org/draft-07/hyper-schema#'"
    },
    "JSONSchema7Definition": {
      "anyOf": [
        {
          "$ref": "#/definitions/JSONSchema7"
        },
        {
          "type": "boolean"
        }
      ],
      "description": "JSON Schema v7"
    },
    "JSONSchema7TypeName": {
      "type": "string",
      "enum": [
        "string",
        "number",
        "integer",
        "boolean",
        "object",
        "array",
        "null"
      ],
      "description": "Primitive type"
    },
    "JSONSchema7Type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "$ref": "#/definitions/JSONSchema7Object"
        },
        {
          "$ref": "#/definitions/JSONSchema7Array"
        },
        {
          "type": "null"
        }
      ],
      "description": "Primitive type"
    },
    "JSONSchema7Object": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/definitions/JSONSchema7Type"
      }
    },
    "JSONSchema7Array": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/JSONSchema7Type"
      }
    },
    "SCPluginRemove": {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "const": "remove",
          "description": "The desired action, so whether the plugin should be added or removed"
        },
        "route": {
          "type": "string",
          "description": "The route of the plugin you want to remove"
        }
      },
      "required": [
        "action",
        "route"
      ],
      "additionalProperties": false,
      "description": "Plugin request for removing a plugin registration from the backend"
    },
    "SCSCPluginRegisterRequest": {
      "anyOf": [
        {
          "$ref": "#/definitions/SCPluginAdd"
        },
        {
          "$ref": "#/definitions/SCPluginRemove"
        }
      ],
      "description": "Plugin register request"
    }
  },
  "$id": "https://core.stapps.tu-berlin.de/v4.0.2/lib/schema/SCPluginRegisterRequest.json"
}