{
  "$schema": "https://json-schema.org/draft-07/schema#",
  "$id": "https://www.agentkind.org/protocol/settlement/v0.1/schemas/settlement-receipt.schema.json",
  "title": "Agentkind Settlement Protocol v0.1 — Settlement Receipt",
  "description": "LAYER 5 (SETTLEMENT). A receipt CLAIM that value moved, rendered from the payer's OWN on-chain transaction. The receipt references the payer's on-chain transaction signature; the VPS never signs, never broadcasts, and never sends $AKIND. non_custodial MUST be true and vps_signed MUST be false. IMPORTANT (Issue #97): schema validity is NOT proof of on-chain settlement. A schema-valid receipt only proves the document is well-formed and self-consistent; it does NOT prove that the referenced request exists, that authorization exists/is current, that the referenced signature exists on-chain, that the transaction succeeded, that token/mint/amount/payer/payee match on-chain, that execution occurred, or that a business outcome was reached. See RECEIPT_VERIFICATION.md for the read-only, reference-aware procedure that a consumer must perform before treating a receipt as evidence of settlement.",
  "type": "object",
  "required": [
    "protocol_version",
    "receipt_id",
    "request_id",
    "authorization_id",
    "settled_by",
    "tx_signature",
    "settled_at",
    "asset",
    "amount",
    "network",
    "settlement_method",
    "non_custodial",
    "vps_signed"
  ],
  "additionalProperties": false,
  "properties": {
    "protocol_version": { "const": "0.1" },
    "receipt_id": { "type": "string", "pattern": "^akind-rcpt-[A-Za-z0-9._-]{4,64}$" },
    "request_id": { "type": "string", "pattern": "^akind-req-[A-Za-z0-9._-]{4,64}$" },
    "authorization_id": { "type": "string", "pattern": "^akind-auth-[A-Za-z0-9._-]{4,64}$" },
    "settled_at": { "type": "string", "format": "date-time", "description": "REQUIRED. When the payer's wallet reported the settlement. Absent => the artifact is not a complete settlement receipt." },
    "settled_by": {
      "type": "string",
      "minLength": 32,
      "maxLength": 128,
      "pattern": "^[1-9A-HJ-NP-Za-km-z]+$",
      "description": "Payer wallet PUBLIC key only (Base58-compatible, Solana-style). Never a private key. Must be a well-formed Base58 string, not arbitrary characters."
    },
    "tx_signature": {
      "type": "string",
      "minLength": 64,
      "maxLength": 128,
      "pattern": "^[1-9A-HJ-NP-Za-km-z]+$",
      "description": "On-chain transaction signature supplied by the payer's own wallet (Base58-compatible). Must be a well-formed Base58 string."
    },
    "asset": {
      "type": "object",
      "required": ["mint", "network", "symbol"],
      "additionalProperties": false,
      "properties": {
        "mint": { "const": "6ab7HysqYKjzeyDRqTRS73jt8UKsK6HfdRfmXEVcpump" },
        "network": { "const": "solana" },
        "symbol": { "const": "AKIND" }
      }
    },
    "amount": {
      "type": "string",
      "pattern": "^[1-9][0-9]*$",
      "description": "Positive integer amount string (>0). '0' and leading-zero forms are rejected. Schema validity does not prove the amount actually transferred on-chain."
    },
    "network": { "const": "solana" },
    "explorer_url": { "type": "string", "format": "uri" },
    "settlement_method": { "enum": ["manual_wallet", "agent_assisted_copy"] },
    "non_custodial": { "const": true, "description": "The protocol never held or moved funds on the payer's behalf." },
    "vps_signed": { "const": false, "description": "The VPS did NOT sign this transaction." }
  }
}
