{
  "type": "object",
  "required": [
    "header",
    "payload"
  ],
  "properties": {
    "header": {
      "allOf": [
        {
          "$ref": "/v2-header"
        },
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "enum": [
                "DiscoveryResponse",
                "ErrorResponse"
              ]
            }
          }
        }
      ]
    },
    "payload": {
      "anyOf": [
        {
          "type": "object",
          "required": [
            "endpoints"
          ],
          "properties": {
            "endpoints": {
              "type": "array",
              "items": {
                "allOf": [
                  {
                    "$ref": "/v2-endpoint"
                  },
                  {
                    "required": [
                      "endpointId",
                      "displayType",
                      "displayName",
                      "additionalInfo",
                      "capabilities",
                      "states"
                    ]
                  }
                ]
              }
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "message": {
              "type": "string"
            }
          }
        }
      ]
    }
  }
}
