{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "key",
    "name",
    "kind",
    "protocol",
    "operations"
  ],
  "properties": {
    "key": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "kind": {
      "type": "string",
      "enum": [
        "hosted",
        "external"
      ]
    },
    "protocol": {
      "type": "string",
      "enum": [
        "commentary-tracker-v1"
      ]
    },
    "operations": {
      "type": "array",
      "maxItems": 14,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": [
          "getSchema",
          "getPermissions",
          "queryRecords",
          "getRecord",
          "createRecord",
          "patchRecord",
          "archiveRecord",
          "bulk",
          "reorder",
          "listViews",
          "getView",
          "changes",
          "openResource",
          "openReview"
        ]
      }
    },
    "trackerId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "packageId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "packageRevisionId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "uploadId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "entry": {
      "type": "string",
      "maxLength": 1024
    },
    "externalUrl": {
      "type": "string",
      "format": "uri",
      "maxLength": 2048
    },
    "anchors": {
      "type": "array",
      "maxItems": 100,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "pageId"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "pageId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "blockId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      }
    }
  },
  "allOf": [
    {
      "anyOf": [
        {
          "required": [
            "trackerId"
          ]
        },
        {
          "required": [
            "packageId",
            "packageRevisionId"
          ]
        }
      ]
    },
    {
      "oneOf": [
        {
          "properties": {
            "kind": {
              "enum": [
                "hosted"
              ]
            }
          },
          "required": [
            "uploadId",
            "entry"
          ],
          "not": {
            "required": [
              "externalUrl"
            ]
          }
        },
        {
          "properties": {
            "kind": {
              "enum": [
                "external"
              ]
            }
          },
          "required": [
            "externalUrl"
          ],
          "not": {
            "anyOf": [
              {
                "required": [
                  "entry"
                ]
              },
              {
                "required": [
                  "uploadId"
                ]
              }
            ]
          }
        }
      ]
    }
  ]
}