{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://fdc3.finos.org/schemas/next/api/WCP4ValidateAppIdentity.schema.json",
  "title": "Web Connection Protocol 4 Validate App Identity",
  "description": "Identity Validation request from an app attempting to connect to a Desktop Agent.",
  "type": "object",
  "allOf": [
    {
      "$ref": "#/$defs/WCP4ValidateAppIdentityBase"
    },
    {
      "$ref": "WCPConnectionStep.schema.json"
    }
  ],
  "$defs": {
    "WCP4ValidateAppIdentityBase": {
      "type": "object",
      "properties": {
        "type": {
          "title": "WCP4ValidateAppIdentity Message Type",
          "const": "WCP4ValidateAppIdentity"
        },
        "payload": {
          "title": "WCP4ValidateAppIdentity Payload",
          "type": "object",
          "properties": {
            "identityUrl": {
              "title": "Identity URL",
              "description": "URL to use for the identity of the application. Desktop Agents MUST validate that the origin of the message matches the URL, but MAY implement custom comparison logic.",
              "type": "string",
              "format": "uri"
            },
            "actualUrl": {
              "title": "Actual URL",
              "description": "The current URL of the page attempting to connect. This may differ from the identityUrl, but the origins MUST match.",
              "type": "string",
              "format": "uri"
            },
            "instanceId": {
              "title": "instanceId",
              "description": "If an application has previously connected to the Desktop Agent, it may specify its prior instance id and associated instance UUID to request the same same instance Id be assigned.",
              "type": "string"
            },
            "instanceUuid": {
              "title": "instanceUuid",
              "description": "Instance UUID associated with the requested instanceId.",
              "type": "string"
            },
            "receiveOwnBroadcasts": {
              "title": "receiveOwnBroadcasts",
              "description": "Flag indicating that the application wishes to receive its own broadcasts, i.e. context messages it broadcasts to a channel it is joined to (or listening on) should be delivered back to it. Defaults to false when omitted, in which case the Desktop Agent SHOULD NOT deliver the application's own broadcasts back to it.",
              "type": "boolean"
            },
            "resolveOwnIntents": {
              "title": "resolveOwnIntents",
              "description": "Flag indicating that the application is willing for its own instance to be considered when resolving intents that it raises. Defaults to false when omitted, in which case the Desktop Agent SHOULD NOT resolve an intent raised by the application instance to that same instance (other instances of the same app remain eligible).",
              "type": "boolean"
            }
          },
          "additionalProperties": false,
          "required": [
            "identityUrl", "actualUrl"
          ]
        },
        "meta": {
          "$ref": "WCPConnectionStep.schema.json#/$defs/ConnectionStepMeta"
        }
      },
      "required": [
        "type",
        "payload",
        "meta"
      ],
      "additionalProperties": false
    }
  }
}