{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "ownerId": {
          "type": "string",
          "minLength": 1
        },
        "datasetId": {
          "type": "string",
          "minLength": 1
        },
        "operationId": {
          "type": "string",
          "minLength": 1
        },
        "sequence": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "entity": {
          "type": "string",
          "enum": [
            "exercise",
            "exercise_variant",
            "exercise_catalog_link",
            "exercise_resolution",
            "exercise_scope_override",
            "exercise_catalog_base_binding"
          ]
        },
        "entityId": {
          "type": "string",
          "minLength": 1
        },
        "before": {
          "anyOf": [
            {
              "$ref": "#/$defs/__schema0"
            },
            {
              "type": "null"
            }
          ]
        },
        "after": {
          "anyOf": [
            {
              "$ref": "#/$defs/__schema0"
            },
            {
              "type": "null"
            }
          ]
        },
        "reason": {
          "type": "string",
          "minLength": 1
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        }
      },
      "required": [
        "id",
        "ownerId",
        "datasetId",
        "operationId",
        "sequence",
        "entity",
        "entityId",
        "before",
        "after",
        "reason",
        "createdAt"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "operationId": {
          "type": "string",
          "minLength": 1
        },
        "ownerId": {
          "type": "string",
          "minLength": 1
        },
        "datasetId": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "enum": ["catalog_port", "custom_mapping", "undo"]
        },
        "payloadHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "mappingVersion": {
          "type": "string",
          "minLength": 1
        },
        "catalogVersion": {
          "type": "string",
          "minLength": 1
        },
        "mappingGeneration": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        },
        "dependsOnOperationIds": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "reversesOperationId": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "review": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string",
                  "enum": ["draft", "approved"]
                },
                "reviewedBy": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "reviewedAt": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "approvedPayloadHash": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": ["status", "reviewedBy", "reviewedAt", "approvedPayloadHash"],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "verification": {
          "type": "object",
          "properties": {
            "resolvedExercises": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "mappedSources": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "taggedSets": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "defaultAttributedSets": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "explicitAttributedSets": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "untaggedSets": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "preservedEvidenceHash": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "projectionHash": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            }
          },
          "required": [
            "resolvedExercises",
            "mappedSources",
            "taggedSets",
            "defaultAttributedSets",
            "explicitAttributedSets",
            "untaggedSets",
            "preservedEvidenceHash",
            "projectionHash"
          ],
          "additionalProperties": false
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        }
      },
      "required": [
        "operationId",
        "ownerId",
        "datasetId",
        "kind",
        "payloadHash",
        "mappingVersion",
        "catalogVersion",
        "mappingGeneration",
        "dependsOnOperationIds",
        "reversesOperationId",
        "review",
        "verification",
        "createdAt"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "operationId": {
          "type": "string",
          "minLength": 1
        },
        "ownerId": {
          "type": "string",
          "minLength": 1
        },
        "datasetId": {
          "type": "string",
          "minLength": 1
        },
        "payload": {
          "$ref": "#/$defs/__schema0"
        },
        "dryRunReport": {
          "$ref": "#/$defs/__schema0"
        }
      },
      "required": ["operationId", "ownerId", "datasetId", "payload", "dryRunReport"],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "ownerId": {
          "type": "string",
          "minLength": 1
        },
        "datasetId": {
          "type": "string",
          "minLength": 1
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "sequence": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        },
        "kind": {
          "type": "string",
          "enum": ["policy_change", "modifier_correction", "undo"]
        },
        "previousChangeId": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "payload": {
          "type": "object",
          "properties": {
            "expectedMappingGeneration": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "dependsOnOperationIds": {
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            },
            "reversesChangeId": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 1
                },
                {
                  "type": "null"
                }
              ]
            },
            "expectedRevisions": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "entityId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "revision": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["entityId", "revision"],
                "additionalProperties": false
              }
            },
            "changes": {
              "type": "object",
              "properties": {
                "beforeState": {
                  "type": "object",
                  "properties": {
                    "variantLoadPolicies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "ownerId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "datasetId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "exerciseId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "variantId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "mode": {
                            "type": "string",
                            "enum": ["own", "shared"]
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "changeId": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": ["ownerId", "datasetId", "exerciseId", "variantId", "mode", "revision", "changeId"],
                        "additionalProperties": false
                      }
                    },
                    "modifierLoadPolicies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "ownerId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "datasetId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "exerciseId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "modifierId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "loadAffecting": {
                            "type": "boolean"
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "changeId": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "ownerId",
                          "datasetId",
                          "exerciseId",
                          "modifierId",
                          "loadAffecting",
                          "revision",
                          "changeId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "modifierAssignments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "ownerId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "datasetId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "scope": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "occurrence"
                                  },
                                  "occurrenceId": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": ["kind", "occurrenceId"],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "set"
                                  },
                                  "occurrenceId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "setId": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": ["kind", "occurrenceId", "setId"],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "template_slot"
                                  },
                                  "versionId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "slotId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "prescriptionId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "bodyHash": {
                                    "type": "string",
                                    "pattern": "^[a-f0-9]{64}$"
                                  }
                                },
                                "required": ["kind", "versionId", "slotId", "bodyHash"],
                                "additionalProperties": false
                              }
                            ]
                          },
                          "sourceExerciseId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "modifiers": {
                            "maxItems": 8,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "builtinKey": {
                                  "type": "string",
                                  "enum": [
                                    "slow-tempo",
                                    "paused",
                                    "partial",
                                    "lengthened-partial",
                                    "deficit",
                                    "dead-stop"
                                  ]
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": ["id", "label"],
                              "additionalProperties": false
                            }
                          },
                          "provenance": {
                            "type": "string",
                            "enum": ["recorded", "reviewed_legacy"]
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "supersedesId": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "changeId": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "active": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "ownerId",
                          "datasetId",
                          "id",
                          "scope",
                          "sourceExerciseId",
                          "modifiers",
                          "provenance",
                          "revision",
                          "supersedesId",
                          "changeId",
                          "active"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["variantLoadPolicies", "modifierLoadPolicies", "modifierAssignments"],
                  "additionalProperties": false
                },
                "afterState": {
                  "type": "object",
                  "properties": {
                    "variantLoadPolicies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "ownerId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "datasetId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "exerciseId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "variantId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "mode": {
                            "type": "string",
                            "enum": ["own", "shared"]
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "changeId": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": ["ownerId", "datasetId", "exerciseId", "variantId", "mode", "revision", "changeId"],
                        "additionalProperties": false
                      }
                    },
                    "modifierLoadPolicies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "ownerId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "datasetId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "exerciseId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "modifierId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "loadAffecting": {
                            "type": "boolean"
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "changeId": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": [
                          "ownerId",
                          "datasetId",
                          "exerciseId",
                          "modifierId",
                          "loadAffecting",
                          "revision",
                          "changeId"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "modifierAssignments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "ownerId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "datasetId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "scope": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "occurrence"
                                  },
                                  "occurrenceId": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": ["kind", "occurrenceId"],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "set"
                                  },
                                  "occurrenceId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "setId": {
                                    "type": "string",
                                    "minLength": 1
                                  }
                                },
                                "required": ["kind", "occurrenceId", "setId"],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "template_slot"
                                  },
                                  "versionId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "slotId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "prescriptionId": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "bodyHash": {
                                    "type": "string",
                                    "pattern": "^[a-f0-9]{64}$"
                                  }
                                },
                                "required": ["kind", "versionId", "slotId", "bodyHash"],
                                "additionalProperties": false
                              }
                            ]
                          },
                          "sourceExerciseId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "modifiers": {
                            "maxItems": 8,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "builtinKey": {
                                  "type": "string",
                                  "enum": [
                                    "slow-tempo",
                                    "paused",
                                    "partial",
                                    "lengthened-partial",
                                    "deficit",
                                    "dead-stop"
                                  ]
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1
                                }
                              },
                              "required": ["id", "label"],
                              "additionalProperties": false
                            }
                          },
                          "provenance": {
                            "type": "string",
                            "enum": ["recorded", "reviewed_legacy"]
                          },
                          "revision": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "supersedesId": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "changeId": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "active": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "ownerId",
                          "datasetId",
                          "id",
                          "scope",
                          "sourceExerciseId",
                          "modifiers",
                          "provenance",
                          "revision",
                          "supersedesId",
                          "changeId",
                          "active"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["variantLoadPolicies", "modifierLoadPolicies", "modifierAssignments"],
                  "additionalProperties": false
                }
              },
              "required": ["beforeState", "afterState"],
              "additionalProperties": false
            }
          },
          "required": [
            "expectedMappingGeneration",
            "dependsOnOperationIds",
            "reversesChangeId",
            "expectedRevisions",
            "changes"
          ],
          "additionalProperties": false
        },
        "beforeState": {
          "type": "object",
          "properties": {
            "variantLoadPolicies": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "ownerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "datasetId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "exerciseId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "variantId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "mode": {
                    "type": "string",
                    "enum": ["own", "shared"]
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "changeId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["ownerId", "datasetId", "exerciseId", "variantId", "mode", "revision", "changeId"],
                "additionalProperties": false
              }
            },
            "modifierLoadPolicies": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "ownerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "datasetId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "exerciseId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "modifierId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "loadAffecting": {
                    "type": "boolean"
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "changeId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "ownerId",
                  "datasetId",
                  "exerciseId",
                  "modifierId",
                  "loadAffecting",
                  "revision",
                  "changeId"
                ],
                "additionalProperties": false
              }
            },
            "modifierAssignments": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "ownerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "datasetId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "scope": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "occurrence"
                          },
                          "occurrenceId": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": ["kind", "occurrenceId"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "set"
                          },
                          "occurrenceId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "setId": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": ["kind", "occurrenceId", "setId"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "template_slot"
                          },
                          "versionId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "slotId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "prescriptionId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "bodyHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          }
                        },
                        "required": ["kind", "versionId", "slotId", "bodyHash"],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "sourceExerciseId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "modifiers": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "builtinKey": {
                          "type": "string",
                          "enum": ["slow-tempo", "paused", "partial", "lengthened-partial", "deficit", "dead-stop"]
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": ["id", "label"],
                      "additionalProperties": false
                    }
                  },
                  "provenance": {
                    "type": "string",
                    "enum": ["recorded", "reviewed_legacy"]
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "supersedesId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "changeId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "active": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "ownerId",
                  "datasetId",
                  "id",
                  "scope",
                  "sourceExerciseId",
                  "modifiers",
                  "provenance",
                  "revision",
                  "supersedesId",
                  "changeId",
                  "active"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": ["variantLoadPolicies", "modifierLoadPolicies", "modifierAssignments"],
          "additionalProperties": false
        },
        "afterState": {
          "type": "object",
          "properties": {
            "variantLoadPolicies": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "ownerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "datasetId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "exerciseId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "variantId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "mode": {
                    "type": "string",
                    "enum": ["own", "shared"]
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "changeId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": ["ownerId", "datasetId", "exerciseId", "variantId", "mode", "revision", "changeId"],
                "additionalProperties": false
              }
            },
            "modifierLoadPolicies": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "ownerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "datasetId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "exerciseId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "modifierId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "loadAffecting": {
                    "type": "boolean"
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "changeId": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "ownerId",
                  "datasetId",
                  "exerciseId",
                  "modifierId",
                  "loadAffecting",
                  "revision",
                  "changeId"
                ],
                "additionalProperties": false
              }
            },
            "modifierAssignments": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "ownerId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "datasetId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "scope": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "occurrence"
                          },
                          "occurrenceId": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": ["kind", "occurrenceId"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "set"
                          },
                          "occurrenceId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "setId": {
                            "type": "string",
                            "minLength": 1
                          }
                        },
                        "required": ["kind", "occurrenceId", "setId"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "template_slot"
                          },
                          "versionId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "slotId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "prescriptionId": {
                            "type": "string",
                            "minLength": 1
                          },
                          "bodyHash": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          }
                        },
                        "required": ["kind", "versionId", "slotId", "bodyHash"],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "sourceExerciseId": {
                    "type": "string",
                    "minLength": 1
                  },
                  "modifiers": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1
                        },
                        "builtinKey": {
                          "type": "string",
                          "enum": ["slow-tempo", "paused", "partial", "lengthened-partial", "deficit", "dead-stop"]
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      "required": ["id", "label"],
                      "additionalProperties": false
                    }
                  },
                  "provenance": {
                    "type": "string",
                    "enum": ["recorded", "reviewed_legacy"]
                  },
                  "revision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  },
                  "supersedesId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "changeId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "active": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "ownerId",
                  "datasetId",
                  "id",
                  "scope",
                  "sourceExerciseId",
                  "modifiers",
                  "provenance",
                  "revision",
                  "supersedesId",
                  "changeId",
                  "active"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": ["variantLoadPolicies", "modifierLoadPolicies", "modifierAssignments"],
          "additionalProperties": false
        },
        "payloadHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        }
      },
      "required": [
        "ownerId",
        "datasetId",
        "id",
        "sequence",
        "kind",
        "previousChangeId",
        "payload",
        "beforeState",
        "afterState",
        "payloadHash",
        "createdAt"
      ],
      "additionalProperties": false
    }
  ],
  "$defs": {
    "__schema0": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema0"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema0"
          }
        }
      ]
    }
  },
  "$id": "https://docs.sendtopigeon.com/schemas/wn-operation-log@1.schema.json",
  "title": "Pigeon Open Data: wn-operation-log@1",
  "$comment": "Apache-2.0. Structural schema; use Zod/parseRecord for semantic invariants. This published schema URL is immutable.",
  "examples": [
    {
      "id": "demo-journal-1",
      "ownerId": "demo-owner",
      "datasetId": "demo-dataset",
      "operationId": "demo-map-1",
      "sequence": 0,
      "entity": "exercise",
      "entityId": "demo-bench",
      "before": {
        "title": "Bench"
      },
      "after": {
        "title": "Bench press"
      },
      "reason": "Clarify exercise name",
      "createdAt": "2026-11-16T15:00:00Z"
    }
  ]
}
