{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://fdc3.finos.org/schemas/next/bridging/openAgentRequest.schema.json",
  "title": "Open Agent Request",
  "type": "object",
  "allOf": [
    {
      "$ref": "#/$defs/OpenRequestBase"
    },
    {
      "$ref": "agentRequest.schema.json"
    }
  ],
  "$defs": {
    "OpenRequestBase": {
      "title": "Open Request",
      "type": "object",
      "description": "A request to open an application",
      "properties": {
        "type": {
          "$ref": "../api/openRequest.schema.json#/$defs/OpenRequestType"
        },
        "payload": {
          "title": "Open Request Payload",
          "type": "object",
          "properties": {
            "app": {
              "type": "object",
              "title": "App to open",
              "description": "The application to open on the specified Desktop Agent",
              "allOf": [
                {
                  "$ref": "../api/api.schema.json#/definitions/DesktopAgentIdentifier"
                },
                {
                  "$ref": "../api/api.schema.json#/definitions/AppIdentifier"
                }
              ]
            },
            "context": {
              "$ref": "../context/context.schema.json"
            }
          },
          "required": ["app"],
          "additionalProperties": false
        },
        "meta":  {
          "title": "Open Request Metadata",
          "properties": {
            "requestUuid": true,
            "timestamp": true,
            "destination": {
              "$ref": "common.schema.json#/$defs/AgentDestination"
            },
            "source": {
              "$ref": "common.schema.json#/$defs/AppRequestSource"
            }
          },
          "required": ["source"],
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    }
  }
}
