{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agentqueryprotocol.com/specification/2026-07-30/schema/query-receipt.schema.json",
  "title": "AQP QueryReceipt",
  "description": "A deterministic acknowledgment for one QueryResponse.",
  "type": "object",
  "additionalProperties": false,
  "required": ["protocolVersion", "responseId", "status", "retryable", "receivedAt"],
  "properties": {
    "protocolVersion": { "const": "2026-07-30" },
    "responseId": { "type": "string", "format": "uuid" },
    "status": { "enum": ["accepted", "duplicate", "rejected", "withdrawn"] },
    "retryable": { "type": "boolean" },
    "reason": { "type": "string", "minLength": 1, "maxLength": 500 },
    "receivedAt": { "type": "string", "format": "date-time" }
  },
  "allOf": [
    {
      "if": { "properties": { "status": { "enum": ["accepted", "duplicate", "withdrawn"] } } },
      "then": { "properties": { "retryable": { "const": false } } }
    },
    {
      "if": { "properties": { "status": { "const": "rejected" } } },
      "then": { "required": ["reason"] }
    }
  ]
}
