{
  "$schema": "https://json-schema.org/draft-07/schema#",
  "$id": "https://www.agentkind.org/protocol/settlement/v0.1/schemas/payment-request.schema.json",
  "title": "Agentkind Settlement Protocol v0.1 — Payment Request",
  "description": "An intent to pay, authored by the payer. This is LAYER 1 (PAYMENT REQUEST) only. It is not authorization, not a signature, not settlement, and not task execution. The protocol is non-custodial: a payment request never instructs the VPS to custody, sign, swap, or send $AKIND.",
  "type": "object",
  "required": [
    "protocol_version",
    "request_id",
    "nonce",
    "payer",
    "payee",
    "asset",
    "amount",
    "direction",
    "memo"
  ],
  "additionalProperties": false,
  "properties": {
    "protocol_version": { "const": "0.1" },
    "request_id": { "type": "string", "pattern": "^akind-req-[A-Za-z0-9._-]{4,64}$" },
    "nonce": { "type": "string", "pattern": "^[A-Za-z0-9._-]{8,64}$", "description": "Replay-protection nonce. Must be unique per (payer, payee, amount, memo) agreement." },
    "created_at": { "type": "string", "format": "date-time" },
    "expires_at": { "type": "string", "format": "date-time" },
    "payer": {
      "type": "object",
      "required": ["kind", "id"],
      "additionalProperties": false,
      "properties": {
        "kind": { "enum": ["human", "agent"] },
        "id": { "type": "string", "minLength": 1, "maxLength": 128 }
      }
    },
    "payee": {
      "type": "object",
      "required": ["kind", "id"],
      "additionalProperties": false,
      "properties": {
        "kind": { "enum": ["human", "agent"] },
        "id": { "type": "string", "minLength": 1, "maxLength": 128 }
      }
    },
    "asset": {
      "type": "object",
      "required": ["mint", "network", "symbol"],
      "additionalProperties": false,
      "properties": {
        "mint": { "const": "6ab7HysqYKjzeyDRqTRS73jt8UKsK6HfdRfmXEVcpump", "description": "Canonical $AKIND mint. Case-sensitive Base58; never normalize." },
        "network": { "const": "solana" },
        "symbol": { "const": "AKIND" }
      }
    },
    "amount": { "type": "string", "pattern": "^[0-9]+$", "description": "Integer string in base units (lamports-like). Never a float." },
    "direction": {
      "enum": ["human_to_human", "human_to_agent", "agent_to_human", "agent_to_agent"]
    },
    "memo": { "type": "string", "minLength": 1, "maxLength": 500, "description": "Human/business description. NOT executable. Never treated as a wallet instruction." },
    "metadata": {
      "type": "array",
      "items": { "type": "string", "maxLength": 256 },
      "description": "Order-sensitive array. Array order is PRESERVED in the fingerprint and MUST NOT be reordered."
    },
    "payment_terms": {
      "type": "object",
      "required": ["deliverable", "acceptance_criteria"],
      "additionalProperties": false,
      "properties": {
        "deliverable": { "type": "string", "maxLength": 1000 },
        "acceptance_criteria": { "type": "string", "maxLength": 1000 }
      }
    },
    "fingerprint": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$", "description": "Optional precomputed fingerprint of the immutable core." },
    "status": {
      "enum": ["draft", "authorized", "awaiting_settlement", "settled", "failed", "expired", "revoked"],
      "description": "Mutable lifecycle state. Excluded from the fingerprint. Optional in a request."
    }
  }
}
