{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:http6:review:rw-envelope:1",
  "title": "HTTP6 Rosario-Wang review envelope (not an adopted HTTP6 wire format)",
  "description": "Representation validation only. Stored context, H-dependent residue ranges, canonical bytes, policy, masks, state, and authenticity are checked separately.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "statement",
    "released",
    "proof_tag"
  ],
  "properties": {
    "statement": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "epoch",
        "event",
        "sender",
        "recipient",
        "channel",
        "direction",
        "stream",
        "device",
        "measurement",
        "operation_id",
        "protocol",
        "kind",
        "sequence",
        "nonce",
        "issued_ns",
        "expires_ns",
        "policy_digest",
        "lineage_digest",
        "request_ref",
        "payload",
        "profile",
        "length",
        "calibration_cells",
        "responses",
        "frames"
      ],
      "properties": {
        "epoch": {
          "type": "string",
          "minLength": 1
        },
        "event": {
          "type": "string",
          "minLength": 1
        },
        "sender": {
          "type": "string",
          "minLength": 1
        },
        "recipient": {
          "type": "string",
          "minLength": 1
        },
        "channel": {
          "type": "string",
          "minLength": 1
        },
        "direction": {
          "type": "string",
          "minLength": 1
        },
        "stream": {
          "type": "string",
          "minLength": 1
        },
        "device": {
          "type": "string",
          "minLength": 1
        },
        "measurement": {
          "type": "string",
          "minLength": 1
        },
        "operation_id": {
          "type": "string",
          "minLength": 1
        },
        "protocol": {
          "const": "http6-rw-review-1.0"
        },
        "kind": {
          "enum": [
            "ADMISSION",
            "MINT",
            "REQUEST",
            "RESPONSE"
          ]
        },
        "sequence": {
          "type": "integer",
          "minimum": 1
        },
        "nonce": {
          "type": "integer",
          "minimum": 0,
          "maximum": 340282366920938463463374607431768211455
        },
        "issued_ns": {
          "type": "integer",
          "minimum": 0
        },
        "expires_ns": {
          "type": "integer",
          "minimum": 0
        },
        "policy_digest": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "lineage_digest": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "request_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "payload": {
          "type": "object",
          "required": [
            "operation",
            "resource",
            "destination"
          ],
          "properties": {
            "operation": {
              "type": "string",
              "minLength": 1
            },
            "resource": {
              "type": "string",
              "minLength": 1
            },
            "destination": {
              "type": "string",
              "minLength": 1
            }
          },
          "additionalProperties": true
        },
        "profile": {
          "enum": [
            "ring4",
            "rw12",
            "rw40"
          ]
        },
        "length": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1024
        },
        "calibration_cells": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3
          },
          "minItems": 2,
          "maxItems": 3
        },
        "responses": {
          "type": "integer",
          "minimum": 4,
          "maximum": 3075
        },
        "frames": {
          "type": "array",
          "minItems": 2,
          "maxItems": 3,
          "items": {
            "type": "array",
            "minItems": 2,
            "maxItems": 4,
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        }
      }
    },
    "released": {
      "type": "array",
      "minItems": 4,
      "maxItems": 3075,
      "items": {
        "type": "integer",
        "minimum": 0,
        "maximum": 3
      }
    },
    "proof_tag": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    }
  }
}
