{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "projectId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "project ID from create/list."
    },
    "expectedRevision": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "description": "Previously read revision; mismatches reject concurrent updates."
    },
    "reason": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500,
      "description": "reason; see schema."
    },
    "definitionId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "definition ID from create/list."
    },
    "action": {
      "type": "string",
      "enum": [
        "attach",
        "detach"
      ],
      "description": "action; see schema."
    },
    "occurrences": {
      "minItems": 1,
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "watchId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "occurrenceId": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          },
          "captureId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "evidenceHash": {
            "type": "string",
            "pattern": "^sha256:[a-f0-9]{64}$"
          }
        },
        "required": [
          "watchId",
          "occurrenceId",
          "captureId",
          "evidenceHash"
        ],
        "additionalProperties": false
      },
      "description": "occurrences; see schema."
    }
  },
  "required": [
    "projectId",
    "expectedRevision",
    "reason",
    "definitionId",
    "action",
    "occurrences"
  ],
  "additionalProperties": false
}
