{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.dharma-ai.io/signing-upgrade-context/v1",
  "title": "Operator review context for preparing an unsubmitted signing upgrade proof",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "organizationId", "repositoryId", "globalEpoch", "predecessorHash", "candidateHash", "installedKeysetHash", "baselineConsumers", "requiredConsumers", "requiredClientIds", "expiresAt"],
  "$defs": {
    "hash": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
    "consumer": { "type": "object", "additionalProperties": false, "required": ["name", "version"],
      "properties": { "name": { "type": "string", "pattern": "^[a-z][a-z0-9-]{0,99}$" },
        "version": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})$" } } },
    "consumers": { "type": "array", "minItems": 2, "maxItems": 20, "items": { "$ref": "#/$defs/consumer" } }
  },
  "properties": {
    "schema": { "const": "dharma.signing-upgrade-context/v1" },
    "organizationId": { "type": "string", "pattern": "^org_[A-Za-z0-9]+$", "maxLength": 200 },
    "repositoryId": { "type": "string", "format": "uuid" },
    "globalEpoch": { "type": "string", "minLength": 1, "maxLength": 160 },
    "predecessorHash": { "$ref": "#/$defs/hash" },
    "candidateHash": { "$ref": "#/$defs/hash" },
    "installedKeysetHash": { "$ref": "#/$defs/hash" },
    "baselineConsumers": { "$ref": "#/$defs/consumers" },
    "requiredConsumers": { "$ref": "#/$defs/consumers" },
    "requiredClientIds": { "type": "array", "minItems": 1, "maxItems": 100, "uniqueItems": true, "items": { "type": "string", "format": "uuid" } },
    "expiresAt": { "type": "string", "format": "date-time" }
  }
}
