{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:junexis:schema:continuity-attestation:0.1",
  "title": "Atestacja ciągłości Junexis 0.1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion", "requestId", "sourceId", "history", "firstSequence",
    "lastSequence", "recoveryId", "store", "dataGeneration", "tenant", "scope",
    "storageLineage", "hostInstance", "epoch", "fencing", "publicationSha256",
    "signedAt", "algorithm", "keyId", "signature"
  ],
  "properties": {
    "schemaVersion": { "const": "junexis.continuity-attestation/0.1" },
    "requestId": { "$ref": "#/$defs/u128" },
    "sourceId": { "$ref": "#/$defs/u128" },
    "history": { "$ref": "#/$defs/u128" },
    "firstSequence": { "$ref": "#/$defs/u64" },
    "lastSequence": { "$ref": "#/$defs/u64" },
    "recoveryId": { "$ref": "#/$defs/u128" },
    "store": { "$ref": "#/$defs/u128" },
    "dataGeneration": { "$ref": "#/$defs/u64" },
    "tenant": { "$ref": "#/$defs/u128" },
    "scope": { "$ref": "#/$defs/u128" },
    "storageLineage": { "$ref": "#/$defs/u128" },
    "hostInstance": { "$ref": "#/$defs/u128" },
    "epoch": { "$ref": "#/$defs/u64" },
    "fencing": { "$ref": "#/$defs/u64" },
    "publicationSha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
    "signedAt": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "algorithm": { "const": "ecdsa-p256-sha256-der" },
    "keyId": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
    "signature": {
      "type": "string",
      "pattern": "^[A-Za-z0-9+/]+={0,2}$",
      "minLength": 8,
      "maxLength": 256
    }
  },
  "$defs": {
    "u128": { "type": "string", "pattern": "^[1-9][0-9]{0,38}$" },
    "u64": { "type": "integer", "minimum": 1, "maximum": 18446744073709551615 }
  }
}
