{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"$id": "https://fdc3.finos.org/schemas/next/api/addEventListenerRequest.schema.json",
	"type": "object",
	"title": "AddEventListener Request",
	"description": "A request to add an event listener for a specified event type to the Desktop Agent.",
	"allOf": [
		{
			"$ref": "appRequest.schema.json"
		},
		{
			"type": "object",
			"properties": {
				"type": {
					"$ref": "#/$defs/AddEventListenerRequestType"
				},
				"payload": {
					"$ref": "#/$defs/AddEventListenerRequestPayload"
				},
				"meta": true
			},
			"additionalProperties": false
		}
	],
	"$defs": {
		"AddEventListenerRequestType": {
			"title": "AddEventListener Request Message Type",
			"const": "addEventListenerRequest"
		},
		"AddEventListenerRequestPayload": {
			"title": "AddEventListener Request Payload",
			"type": "object",
			"properties": {
				"type": {
					"title": "Event type",
					"description": "The type of the event to be listened to or `null` to listen to all event types.",
					"oneOf": [
						{
							"$ref": "api.schema.json#/definitions/FDC3EventType"
						},
						{
							"type": "null"
						}
					]
				},
				"channelId": {
					"title": "Channel Id",
					"description": "The Id of the Channel that a Channel-scoped listener registration applies to (as registered via `Channel.addEventListener`). Set to `null` for Desktop Agent-level listener registrations (as registered via `DesktopAgent.addEventListener`), whose scope follows the app's current User channel. Currently only relevant to the `CONTEXT_CLEARED` event type.",
					"type": ["string", "null"]
				}
			},
			"additionalProperties": false,
			"required": [
				"type",
				"channelId"
			]
		}
	}
}