{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agenticfabricationnetwork-ai/json-schema/agenticfabricationnetwork-ai-transaction-attestation-schema.json",
  "title": "TransactionAttestation",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agenticfabricationnetwork-ai-openapi.json#/components/schemas/TransactionAttestation",
  "type": "object",
  "required": [
    "attestation_id",
    "ufp_version",
    "request",
    "outcome",
    "occurred_at"
  ],
  "properties": {
    "attestation_id": {
      "type": "string",
      "description": "Vendor-generated idempotency key — resubmitting the same id updates the attestation (quoted_only → fulfilled), never duplicates"
    },
    "ufp_version": {
      "type": "string"
    },
    "request": {
      "type": "object",
      "description": "What the buyer asked for — raw, pre-resolution (demand-signal grade)",
      "properties": {
        "process": {
          "type": "string",
          "enum": [
            "fdm_print",
            "resin_print",
            "powder_print",
            "metal_print",
            "elastomer_print",
            "cnc",
            "sheetmetal",
            "laser_cut",
            "decal",
            "print",
            "apparel"
          ]
        },
        "spec": {
          "type": "object",
          "additionalProperties": true
        },
        "constraints": {
          "type": "object",
          "additionalProperties": true
        }
      }
    },
    "offer": {
      "type": "object",
      "description": "What was offered/made. Prices may be omitted if commercially sensitive (less credit)",
      "properties": {
        "spec_resolved": {
          "type": "object",
          "additionalProperties": true
        },
        "quantity": {
          "type": "integer"
        },
        "subtotal_cents": {
          "type": "integer"
        }
      }
    },
    "outcome": {
      "type": "string",
      "enum": [
        "quoted_only",
        "ordered",
        "fulfilled",
        "cancelled",
        "refunded",
        "lost_capability_gap"
      ]
    },
    "gaps": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "requested": {
            "description": "string or number"
          },
          "provided": {
            "description": "string or number; null = the sale was lost on this gap"
          },
          "reason": {
            "type": "string",
            "enum": [
              "vendor_minimum",
              "vendor_maximum",
              "out_of_stock",
              "capability_gap",
              "lead_time",
              "price",
              "other"
            ]
          },
          "note": {
            "type": "string"
          }
        }
      },
      "description": "What could not be delivered as asked — e.g. {field:\"quantity\", requested:3, provided:10, reason:\"vendor_minimum\"}. Feeds the network's demand-gap routing."
    },
    "occurred_at": {
      "type": "string",
      "format": "date-time"
    },
    "fulfilled_at": {
      "type": "string",
      "format": "date-time"
    },
    "evidence": {
      "type": "object",
      "additionalProperties": true,
      "description": "Evidence bundle — mandatory when available, never necessitated: tracking (or a declared-untracked marker), request/offer/file payload hashes, result photos, invoice_ref, delivered_at, buyer_hash (HMAC — no PII), buyer_confirmation_token"
    }
  }
}