{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://missionweaveprotocol.dev/schemas/0.1/group-snapshot.schema.json",
  "title": "MissionWeaveProtocol 0.1 Signed Group Snapshot",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "snapshotId",
    "groupId",
    "throughSequence",
    "eventIds",
    "stateHash",
    "policyLog",
    "createdBy",
    "createdAt",
    "signature"
  ],
  "properties": {
    "snapshotId": { "$ref": "common.schema.json#/$defs/id" },
    "groupId": { "$ref": "common.schema.json#/$defs/id" },
    "throughSequence": { "$ref": "common.schema.json#/$defs/positiveInteger" },
    "eventIds": {
      "type": "array",
      "items": { "$ref": "common.schema.json#/$defs/id" },
      "minItems": 1,
      "uniqueItems": true
    },
    "stateHash": { "$ref": "common.schema.json#/$defs/sha256" },
    "policyLog": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["entryId", "decision", "actor", "occurredAt", "details"],
        "properties": {
          "entryId": { "$ref": "common.schema.json#/$defs/id" },
          "decision": { "type": "string", "minLength": 1, "maxLength": 4000 },
          "actor": { "$ref": "common.schema.json#/$defs/actor" },
          "occurredAt": { "$ref": "common.schema.json#/$defs/timestamp" },
          "details": { "type": "object" }
        }
      }
    },
    "createdBy": {
      "type": "object",
      "additionalProperties": false,
      "required": ["type", "id"],
      "properties": {
        "type": { "const": "service" },
        "id": { "$ref": "common.schema.json#/$defs/id" }
      }
    },
    "createdAt": { "$ref": "common.schema.json#/$defs/timestamp" },
    "signature": { "$ref": "common.schema.json#/$defs/signature" }
  }
}
