{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://capp.local/schemas/capp.receipt.v1.schema.json",
  "title": "cApp server receipt v1",
  "type": "object",
  "required": [
    "protocol",
    "receiptId",
    "serverId",
    "route",
    "method",
    "capability",
    "group",
    "risk",
    "result",
    "createdAt"
  ],
  "properties": {
    "protocol": {
      "const": "capp.receipt.v1"
    },
    "receiptId": {
      "type": "string"
    },
    "serverId": {
      "type": "string"
    },
    "route": {
      "type": "string",
      "pattern": "^/"
    },
    "method": {
      "type": "string"
    },
    "capability": {
      "type": "string"
    },
    "group": {
      "type": "string"
    },
    "risk": {
      "enum": [
        "low",
        "medium",
        "high",
        "critical"
      ]
    },
    "result": {
      "type": "string"
    },
    "createdAt": {
      "type": "string"
    },
    "requestId": {
      "type": "string"
    },
    "subject": {
      "type": "string"
    },
    "bodySha256": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{64}$"
    },
    "responseSha256": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{64}$"
    },
    "gateway": {
      "type": "object"
    },
    "metadata": {
      "type": "object"
    }
  },
  "additionalProperties": true
}
