{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://fdc3.finos.org/schemas/2.1/bridging/findInstancesAgentRequest.schema.json",
  "title": "FindInstances Agent Request",
  "type": "object",
  "allOf": [
    {
      "$ref": "#/$defs/FindInstancesRequestBase"
    },
    {
      "$ref": "agentRequest.schema.json"
    }
  ],
  "$defs": {
    "FindInstancesRequestBase": {
      "title": "FindInstances Request",
      "type": "object",
      "description": "A request for details of instances of a particular app",
      "properties":{
        "type": {
          "title": "FindInstances Request Message Type",
          "const": "findInstancesRequest"
        },
        "payload": {
          "type": "object",
          "title": "FindInstances Request Payload",
          "properties": {
            "app": {
              "$ref": "../api/api.schema.json#/definitions/AppIdentifier"
            }
          },
          "required": ["app"],
          "additionalProperties": false
        },
        "meta": {
          "title": "FindInstances request metadata",
          "type": "object",
          "properties": {
            "requestUuid": true,
            "timestamp": true,
            "destination": {
              "$ref": "common.schema.json#/$defs/AgentDestination"
            },
            "source": {
              "oneOf": [
                {
                  "$ref": "../api/api.schema.json#/definitions/DesktopAgentIdentifier"
                },
                {
                  "$ref": "../api/api.schema.json#/definitions/AppIdentifier"
                }
              ]
            }
          },
          "unevaluatedProperties": false
        }
      },
      "additionalProperties": false
    }
  }
}
