{
  "$defs": {
    "AspectRef": {
      "additionalProperties": false,
      "properties": {
        "aspectId": {
          "maxLength": 512,
          "minLength": 1,
          "type": "string"
        },
        "entityId": {
          "maxLength": 512,
          "minLength": 1,
          "type": "string"
        },
        "target": {
          "$ref": "#/$defs/Target"
        }
      },
      "required": [
        "target",
        "entityId",
        "aspectId"
      ],
      "type": "object"
    },
    "Binding": {
      "additionalProperties": false,
      "properties": {
        "capabilityUse": {
          "$ref": "#/$defs/EntityRef"
        },
        "capabilityUseRevision": {
          "maxLength": 512,
          "minLength": 1,
          "type": "string"
        },
        "contextRef": {
          "$ref": "#/$defs/EntityRef"
        },
        "descriptorRevision": {
          "maxLength": 512,
          "minLength": 1,
          "type": "string"
        },
        "selectionRevision": {
          "maxLength": 512,
          "minLength": 1,
          "type": "string"
        },
        "target": {
          "$ref": "#/$defs/Target"
        }
      },
      "required": [
        "target",
        "descriptorRevision"
      ],
      "type": "object"
    },
    "EntityRef": {
      "additionalProperties": false,
      "properties": {
        "entityId": {
          "maxLength": 512,
          "minLength": 1,
          "type": "string"
        },
        "target": {
          "$ref": "#/$defs/Target"
        }
      },
      "required": [
        "target",
        "entityId"
      ],
      "type": "object"
    },
    "RevisionCheck": {
      "additionalProperties": false,
      "properties": {
        "ref": {
          "$ref": "#/$defs/SubjectRef"
        },
        "revision": {
          "maxLength": 512,
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "ref",
        "revision"
      ],
      "type": "object"
    },
    "SubjectRef": {
      "oneOf": [
        {
          "$ref": "#/$defs/EntityRef"
        },
        {
          "$ref": "#/$defs/AspectRef"
        }
      ]
    },
    "Target": {
      "additionalProperties": false,
      "properties": {
        "id": {
          "maxLength": 512,
          "minLength": 1,
          "type": "string"
        },
        "instanceId": {
          "maxLength": 512,
          "minLength": 1,
          "type": "string"
        },
        "kind": {
          "enum": [
            "jellybox",
            "jellyhub"
          ]
        }
      },
      "required": [
        "kind",
        "id",
        "instanceId"
      ],
      "type": "object"
    }
  },
  "$id": "urn:jellybox:protocol:1.0:perform_action",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "actionRef": {
      "$ref": "#/$defs/EntityRef"
    },
    "binding": {
      "$ref": "#/$defs/Binding"
    },
    "interactionId": {
      "maxLength": 512,
      "minLength": 1,
      "type": "string"
    },
    "parameters": {
      "type": "object"
    },
    "preconditions": {
      "items": {
        "$ref": "#/$defs/RevisionCheck"
      },
      "maxItems": 100,
      "type": "array"
    },
    "requestId": {
      "maxLength": 512,
      "minLength": 1,
      "type": "string"
    }
  },
  "required": [
    "interactionId",
    "actionRef",
    "binding",
    "parameters"
  ],
  "type": "object"
}
