{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://heartcortex.ai/schemas/1.0/receipt.schema.json",
  "title": "Valve receipt",
  "description": "Proof of what crossed the boundary. Holds paths and hashes, never values.",
  "type": "object",
  "required": [
    "id",
    "recipient",
    "highestLevelSent"
  ],
  "properties": {
    "id": {
      "$ref": "common.schema.json#/$defs/uuid",
      "x-heart-privacy": "public"
    },
    "recipient": {
      "type": "object",
      "required": [
        "kind"
      ],
      "x-heart-privacy": "public",
      "properties": {
        "kind": {
          "enum": [
            "model-provider",
            "peer",
            "gateway",
            "subscriber"
          ]
        },
        "name": {
          "type": "string",
          "x-heart-privacy": "internal"
        }
      }
    },
    "highestLevelSent": {
      "$ref": "common.schema.json#/$defs/messageLevel",
      "x-heart-privacy": "public"
    },
    "purpose": {
      "type": "string",
      "x-heart-privacy": "internal"
    },
    "bytesSent": {
      "type": "integer",
      "minimum": 0,
      "x-heart-privacy": "internal"
    },
    "contentSha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$",
      "x-heart-privacy": "internal",
      "description": "Salted commitment: SHA-256 over a fresh random salt of at least 32 bytes followed by the exact payload. The salt goes to the recipient, never into the receipt."
    },
    "commitment": {
      "enum": [
        "sha256-salted"
      ],
      "x-heart-privacy": "internal"
    },
    "transforms": {
      "type": "array",
      "x-heart-privacy": "internal",
      "items": {
        "type": "object",
        "required": [
          "path",
          "op"
        ],
        "properties": {
          "path": {
            "type": "string",
            "description": "Same <message>:<JSON Pointer> form as the Card's valve.classifications."
          },
          "op": {
            "enum": [
              "drop",
              "mask",
              "hash",
              "summarize",
              "aggregate"
            ],
            "description": "drop: removed. mask: replaced by a fixed mask. hash: replaced by HMAC-SHA-256 under a key only the system holds (API Standard 4.5). summarize: replaced by a summary. aggregate: combined with other values."
          }
        }
      }
    },
    "blocked": {
      "type": "boolean",
      "x-heart-privacy": "public"
    },
    "ext": {
      "$ref": "common.schema.json#/$defs/ext",
      "x-heart-privacy": "private"
    }
  }
}
