{
  "openapi": "3.1.0",
  "info": {
    "title": "Scope & Sum",
    "version": "0.5.2",
    "description": "Free public preview by Chimes In LLC. Compares explicit supplier statements and reviewed inputs against purchase requirements across products and services. No independent source verification, purchases, or payment collection.",
    "contact": {
      "name": "Chimes In LLC",
      "email": "support@chimes-in.com",
      "url": "https://scopeandsum.com/"
    }
  },
  "servers": [
    {
      "url": "https://scopeandsum.com"
    }
  ],
  "paths": {
    "/api/compare": {
      "post": {
        "operationId": "compare_supplier_quotes",
        "summary": "Check one to three supplier offers against explicit purchase requirements",
        "description": "Returns source-linked unmet requirements, missing facts, mixed-unit clarifications, integer-cent totals, recurring fees, and supplier questions. Applies to structured product and service quotes. This free preview collects no payment. 30 POST requests per minute per client IP, approximate per Cloudflare location. Maximum request body 1 MiB.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComparisonInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Comparison of supplier-stated evidence",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComparisonReport"
                }
              }
            }
          },
          "403": {
            "description": "Cross-origin browser submission rejected"
          },
          "415": {
            "description": "Send application/json"
          },
          "422": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Preview rate limit exceeded; Retry-After: 60"
          },
          "503": {
            "description": "Service configuration unavailable"
          }
        }
      }
    },
    "/api/demo": {
      "get": {
        "operationId": "get_demo_quotes",
        "summary": "Read fictional demo requirements and quotes",
        "responses": {
          "200": {
            "description": "Fictional sample input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComparisonInput"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "scenario",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "furniture",
                "kitchen",
                "cleaning"
              ],
              "default": "furniture"
            }
          }
        ]
      }
    },
    "/api/extract": {
      "post": {
        "operationId": "extract_csv_quote_template",
        "summary": "Extract a draft from a supported CSV record template",
        "parameters": [
          {
            "name": "filename",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "quote.csv"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "text/csv": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Quote draft with review_required: true"
          },
          "422": {
            "description": "Malformed or unsupported template"
          },
          "429": {
            "description": "Preview rate limit exceeded"
          }
        }
      }
    },
    "/api/capabilities": {
      "get": {
        "operationId": "get_scope_and_sum_capabilities",
        "summary": "Read current inputs, limits, payment status, and operator",
        "responses": {
          "200": {
            "description": "Current public preview capabilities"
          }
        }
      }
    },
    "/api/revisions": {
      "post": {
        "operationId": "review_quote_revisions",
        "summary": "Compare original and revised quotes from the same supplier",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "requirements",
                  "before",
                  "after"
                ],
                "properties": {
                  "requirements": {
                    "$ref": "#/components/schemas/Requirements"
                  },
                  "before": {
                    "$ref": "#/components/schemas/Quote"
                  },
                  "after": {
                    "$ref": "#/components/schemas/Quote"
                  },
                  "documents": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "required": [
                        "document",
                        "text"
                      ],
                      "properties": {
                        "document": {
                          "type": "string"
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 100000
                        }
                      }
                    },
                    "description": "Shared reference text for both versions, unless overridden by before_documents or after_documents."
                  },
                  "before_documents": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "required": [
                        "document",
                        "text"
                      ],
                      "properties": {
                        "document": {
                          "type": "string"
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 100000
                        }
                      }
                    },
                    "description": "Reference text for the original quote only. Takes precedence over shared documents for this version."
                  },
                  "after_documents": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "required": [
                        "document",
                        "text"
                      ],
                      "properties": {
                        "document": {
                          "type": "string"
                        },
                        "text": {
                          "type": "string",
                          "maxLength": 100000
                        }
                      }
                    },
                    "description": "Reference text for the revised quote only. Use this when the original and revised documents have the same filename but different contents."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Changed fields, source evidence, before/after requirement reviews, upfront delta, unsigned hash receipt, and billing.charged=false",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevisionReport"
                }
              }
            }
          },
          "422": {
            "description": "Invalid or ambiguous input"
          },
          "429": {
            "description": "Rate limit"
          }
        }
      }
    },
    "/api/revision-demo": {
      "get": {
        "operationId": "get_revision_example",
        "responses": {
          "200": {
            "description": "Fictional original and revised quotes and requirements"
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "get_service_readiness",
        "summary": "Read release identity and required binding readiness",
        "responses": {
          "200": {
            "description": "Required request-protection binding is configured. Includes build_id; does not verify model providers or payments."
          },
          "503": {
            "description": "Required request-protection binding is missing."
          }
        }
      }
    },
    "/api/payments/status": {
      "get": {
        "operationId": "get_payment_readiness",
        "summary": "Inspect draft payment readiness without sending funds",
        "description": "Reports the approved draft 0.10 USDC price per comparison and configuration readiness. It is not a payment challenge; no public paid endpoint is available and collection remains disabled. Provider authentication is not performed by this status operation.",
        "responses": {
          "200": {
            "description": "Read-only payment status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "payment_collection",
                    "paid_endpoint_available",
                    "approved_price",
                    "provider_credentials_configured",
                    "payment_storage_ready"
                  ],
                  "properties": {
                    "payment_collection": {
                      "const": false
                    },
                    "paid_endpoint_available": {
                      "const": false
                    },
                    "approved_price": {
                      "type": "object",
                      "required": [
                        "amount_micro",
                        "currency",
                        "network",
                        "per"
                      ],
                      "properties": {
                        "amount_micro": {
                          "const": "100000"
                        },
                        "currency": {
                          "const": "USDC"
                        },
                        "network": {
                          "const": "eip155:8453"
                        },
                        "per": {
                          "const": "comparison"
                        }
                      }
                    },
                    "provider_credentials_configured": {
                      "type": "boolean"
                    },
                    "payment_storage_ready": {
                      "type": "boolean"
                    },
                    "mainnet_pilot_enabled": {
                      "type": "boolean"
                    },
                    "paid_endpoint_implemented": {
                      "type": "boolean"
                    },
                    "encrypted_report_storage_ready": {
                      "type": "boolean"
                    },
                    "mainnet_settlement_verified": {
                      "type": "boolean"
                    },
                    "dedicated_chain_provider_configured": {
                      "type": "boolean"
                    },
                    "pilot_receiver": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/paid/compare": {
      "post": {
        "summary": "Direct paid comparison protocol (collection disabled; owner pilot separately gated)",
        "description": "Prepare an encrypted snapshot before signing; save the random recovery code securely first. Use the exact server-provided nonce. Generic x402 clients that choose a fresh nonce are not compatible. Do not automatically sign again after a timeout. Recover this same request. Public collection remains disabled pending a mainnet pilot, dedicated Base RPC and policy review.",
        "security": [
          {
            "RecoveryCode": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-Test-Access",
            "schema": {
              "type": "string"
            },
            "description": "Private owner code, required for prepare/pay while pilot-only."
          },
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "schema": {
              "type": "string",
              "maxLength": 32768
            },
            "description": "Optional base64 JSON x402 v2 payload; alternatively use body payment, never both."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "id",
                  "phase"
                ],
                "properties": {
                  "id": {
                    "type": "string",
                    "pattern": "^pay_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
                  },
                  "phase": {
                    "enum": [
                      "prepare",
                      "pay",
                      "recover",
                      "reconcile"
                    ]
                  },
                  "payer": {
                    "type": "string"
                  },
                  "comparison": {
                    "$ref": "#/components/schemas/ComparisonInput"
                  },
                  "storage_consent": {
                    "type": "boolean",
                    "description": "Must be true to prepare. Report maximum 512 KiB. Recovery code required to decrypt."
                  },
                  "payment": {
                    "type": "object"
                  },
                  "transaction": {
                    "type": "string",
                    "description": "Optional transaction hash for reconciliation after the 5000-block automatic search window."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Prepared, not attempted; or settled with saved report and transaction. Always inspect state and billing."
          },
          "202": {
            "description": "Outcome pending/unknown; charged:null. Recover this request, do not authorize another."
          },
          "402": {
            "description": "Prepared challenge or invalid authorization. PAYMENT-REQUIRED contains base64 JSON; body supplies the mandatory nonce."
          },
          "403": {
            "description": "Recovery code mismatch, private pilot access expired, or browser origin rejected."
          },
          "404": {
            "description": "Unknown request."
          },
          "409": {
            "description": "Request input or payer changed."
          },
          "410": {
            "description": "Unpaid intent or paid-report recovery expired. No new charge."
          },
          "415": {
            "description": "Send application/json."
          },
          "422": {
            "description": "Invalid input, storage consent, recovery code or payment header."
          },
          "429": {
            "description": "Rate limit or one-attempt pilot limit."
          },
          "500": {
            "description": "Operation interrupted; recover this request before signing again."
          },
          "503": {
            "description": "Collection disabled, provider unavailable or report integrity failure; inspect state and recover before signing."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Source": {
        "type": "object",
        "required": [
          "document",
          "location",
          "excerpt"
        ],
        "properties": {
          "document": {
            "type": "string",
            "maxLength": 250
          },
          "location": {
            "type": "string",
            "maxLength": 250
          },
          "excerpt": {
            "type": "string",
            "maxLength": 2000,
            "description": "CSV extraction preserves the original record text, including quoting and embedded newlines, truncated to 2000 characters. Other callers supply their own excerpts."
          },
          "reviewed_edit": {
            "type": "boolean",
            "description": "True when supplied fields were edited; original excerpts no longer verify those edits."
          }
        }
      },
      "Requirement": {
        "type": "object",
        "required": [
          "category",
          "quantity"
        ],
        "properties": {
          "category": {
            "type": "string",
            "maxLength": 60
          },
          "quantity": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000
              },
              {
                "type": "string",
                "pattern": "^\\d+$"
              }
            ]
          },
          "min_ram_gb": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000
              },
              {
                "type": "string",
                "pattern": "^\\d+$"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true
          },
          "min_external_displays": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000
              },
              {
                "type": "string",
                "pattern": "^\\d+$"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true
          },
          "min_warranty_months": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000
              },
              {
                "type": "string",
                "pattern": "^\\d+$"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true
          },
          "required_model": {
            "type": [
              "string",
              "null"
            ],
            "description": "Exact case-sensitive model identifier required for every item in this category; surrounding whitespace is trimmed. Generic text specification checks remain case-insensitive."
          },
          "checks": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/SpecificationCheck"
            }
          }
        },
        "additionalProperties": false
      },
      "Item": {
        "type": "object",
        "required": [
          "category",
          "description",
          "quantity",
          "source"
        ],
        "properties": {
          "category": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000
              },
              {
                "type": "string",
                "pattern": "^\\d+$"
              }
            ]
          },
          "unit_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d+(\\.\\d{1,2})?$"
              },
              {
                "type": "null"
              }
            ]
          },
          "ram_gb": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000
              },
              {
                "type": "string",
                "pattern": "^\\d+$"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true
          },
          "external_displays": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000
              },
              {
                "type": "string",
                "pattern": "^\\d+$"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true
          },
          "warranty_months": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000
              },
              {
                "type": "string",
                "pattern": "^\\d+$"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100
          },
          "attributes": {
            "type": "object",
            "maxProperties": 40,
            "propertyNames": {
              "pattern": "^[a-z][a-z0-9_]{0,63}$"
            },
            "additionalProperties": {
              "$ref": "#/components/schemas/QuotedSpecification"
            }
          }
        }
      },
      "Fee": {
        "type": "object",
        "required": [
          "description",
          "frequency",
          "source"
        ],
        "properties": {
          "description": {
            "type": "string"
          },
          "amount": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d+(\\.\\d{1,2})?$"
              },
              {
                "type": "null"
              }
            ]
          },
          "frequency": {
            "enum": [
              "one_time",
              "monthly",
              "annual",
              "unknown"
            ]
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          }
        }
      },
      "Quote": {
        "type": "object",
        "required": [
          "id",
          "supplier",
          "currency",
          "metadata_source",
          "items",
          "fees",
          "tax_status",
          "total_source"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 100
          },
          "supplier": {
            "type": "string"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Za-z]{3}$"
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "metadata_source": {
            "$ref": "#/components/schemas/Source"
          },
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/Item"
            }
          },
          "fees": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/Fee"
            }
          },
          "tax_status": {
            "enum": [
              "included",
              "excluded",
              "unknown"
            ]
          },
          "tax_amount": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d+(\\.\\d{1,2})?$"
              },
              {
                "type": "null"
              }
            ]
          },
          "stated_total": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d+(\\.\\d{1,2})?$"
              },
              {
                "type": "null"
              }
            ]
          },
          "total_source": {
            "$ref": "#/components/schemas/Source"
          },
          "tax_source": {
            "$ref": "#/components/schemas/Source",
            "description": "Evidence for the tax status and amount. CSV extraction preserves the tax row separately. If omitted, total_source is used for compatibility."
          }
        }
      },
      "ComparisonInput": {
        "type": "object",
        "required": [
          "requirements",
          "quotes"
        ],
        "properties": {
          "requirements": {
            "$ref": "#/components/schemas/Requirements"
          },
          "quotes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/Quote"
            }
          },
          "documents": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "type": "object",
              "required": [
                "document",
                "text"
              ],
              "properties": {
                "document": {
                  "type": "string"
                },
                "text": {
                  "type": "string",
                  "maxLength": 100000
                }
              }
            },
            "description": "Optional reference text. Exact excerpt matching only, not authenticity verification. Maximum total 500000 characters."
          }
        }
      },
      "Finding": {
        "type": "object",
        "required": [
          "severity",
          "code",
          "message",
          "question",
          "sources"
        ],
        "properties": {
          "severity": {
            "enum": [
              "issue",
              "question",
              "review"
            ]
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "question": {
            "type": "string"
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Source"
            }
          }
        }
      },
      "ComparisonReport": {
        "type": "object",
        "required": [
          "schema_version",
          "evaluated_at",
          "evidence_level",
          "totals_comparable",
          "quotes",
          "limitations",
          "receipt",
          "requirements",
          "billing",
          "service",
          "input_provenance"
        ],
        "properties": {
          "schema_version": {
            "const": "0.4.18"
          },
          "evaluated_at": {
            "type": "string",
            "format": "date-time"
          },
          "evidence_level": {
            "const": "supplier_statements"
          },
          "summary": {
            "type": "string"
          },
          "totals_comparable": {
            "type": "boolean"
          },
          "quotes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuoteReview"
            }
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "billing": {
            "type": "object",
            "required": [
              "charged",
              "mode"
            ],
            "properties": {
              "charged": {
                "const": false
              },
              "mode": {
                "const": "free_preview"
              }
            }
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          },
          "requirements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Requirement"
            }
          },
          "service": {
            "type": "string"
          },
          "input_provenance": {
            "type": "string"
          }
        }
      },
      "SpecificationCheck": {
        "type": "object",
        "required": [
          "field",
          "operator",
          "value"
        ],
        "properties": {
          "field": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "operator": {
            "type": "string",
            "enum": [
              "gte",
              "lte",
              "eq"
            ]
          },
          "value": {
            "oneOf": [
              {
                "type": "number",
                "minimum": -1000000000000,
                "maximum": 1000000000000
              },
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              {
                "type": "boolean"
              }
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 40
          }
        },
        "description": "gte/lte require a numeric value. Unit names must exactly match the quoted unit; no conversion. For text/booleans omit unit or use null. Unknown specification options are rejected.",
        "additionalProperties": false
      },
      "QuotedSpecification": {
        "type": "object",
        "required": [
          "value"
        ],
        "properties": {
          "value": {
            "oneOf": [
              {
                "type": "number",
                "minimum": -1000000000000,
                "maximum": 1000000000000
              },
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 250
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 40
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          }
        },
        "description": "Use a matching explicit unit for numeric checks. Source falls back to the item source if omitted."
      },
      "Receipt": {
        "type": "object",
        "required": [
          "version",
          "rules_version",
          "signed",
          "requirements_sha256",
          "input_sha256",
          "result_sha256",
          "created_at",
          "scope"
        ],
        "properties": {
          "version": {
            "type": "string"
          },
          "rules_version": {
            "type": "string"
          },
          "signed": {
            "const": false
          },
          "requirements_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "input_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "result_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "scope": {
            "type": "string"
          }
        }
      },
      "RequirementResult": {
        "type": "object",
        "required": [
          "category",
          "field",
          "expected",
          "actual",
          "status",
          "sources"
        ],
        "properties": {
          "category": {
            "type": "string"
          },
          "field": {
            "type": "string"
          },
          "expected": {
            "type": [
              "string",
              "number",
              "boolean",
              "null"
            ]
          },
          "actual": {
            "type": [
              "string",
              "number",
              "boolean",
              "null"
            ]
          },
          "status": {
            "enum": [
              "passed",
              "failed",
              "unknown"
            ]
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Source"
            }
          },
          "item_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "operator": {
            "enum": [
              "gte",
              "lte",
              "eq"
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "EvidenceCheck": {
        "type": "object",
        "required": [
          "source",
          "status"
        ],
        "properties": {
          "source": {
            "$ref": "#/components/schemas/Source"
          },
          "status": {
            "enum": [
              "excerpt_found",
              "excerpt_not_found",
              "not_checked",
              "reviewed_edit"
            ]
          }
        }
      },
      "PurchaseReview": {
        "type": "object",
        "required": [
          "status",
          "authorizes_purchase",
          "evidence_attention_required"
        ],
        "properties": {
          "status": {
            "enum": [
              "requirements_failed",
              "needs_clarification",
              "review_required",
              "requirements_met"
            ]
          },
          "authorizes_purchase": {
            "const": false
          },
          "evidence_attention_required": {
            "type": "boolean"
          }
        }
      },
      "NormalizedFee": {
        "type": "object",
        "required": [
          "description",
          "frequency",
          "amount_cents",
          "source"
        ],
        "properties": {
          "description": {
            "type": "string"
          },
          "frequency": {
            "enum": [
              "one_time",
              "monthly",
              "annual",
              "unknown"
            ]
          },
          "amount_cents": {
            "type": [
              "integer",
              "null"
            ]
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          }
        }
      },
      "NormalizedItem": {
        "type": "object",
        "required": [
          "id",
          "category",
          "model",
          "description",
          "quantity",
          "unit_cents",
          "ram_gb",
          "external_displays",
          "warranty_months",
          "attributes",
          "source"
        ],
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": "string"
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "integer",
            "minimum": 0
          },
          "unit_cents": {
            "type": [
              "integer",
              "null"
            ]
          },
          "ram_gb": {
            "type": [
              "integer",
              "null"
            ]
          },
          "external_displays": {
            "type": [
              "integer",
              "null"
            ]
          },
          "warranty_months": {
            "type": [
              "integer",
              "null"
            ]
          },
          "attributes": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/QuotedSpecification"
            }
          },
          "source": {
            "$ref": "#/components/schemas/Source"
          }
        }
      },
      "QuoteReview": {
        "type": "object",
        "required": [
          "id",
          "supplier",
          "currency",
          "decision",
          "total_complete",
          "calculated_upfront_cents",
          "stated_total_cents",
          "findings",
          "supplier_questions",
          "valid_until",
          "item_subtotal_cents",
          "one_time_fees_cents",
          "tax_status",
          "tax_cents",
          "recurring_fees",
          "items",
          "fees",
          "requirement_results",
          "evidence_checks",
          "purchase_review"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "supplier": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "decision": {
            "enum": [
              "requirements_not_met",
              "needs_clarification",
              "review_terms",
              "meets_quoted_requirements"
            ]
          },
          "total_complete": {
            "type": "boolean"
          },
          "calculated_upfront_cents": {
            "type": [
              "integer",
              "null"
            ]
          },
          "stated_total_cents": {
            "type": [
              "integer",
              "null"
            ]
          },
          "findings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Finding"
            }
          },
          "supplier_questions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_subtotal_cents": {
            "type": [
              "integer",
              "null"
            ]
          },
          "one_time_fees_cents": {
            "type": [
              "integer",
              "null"
            ]
          },
          "tax_status": {
            "enum": [
              "included",
              "excluded",
              "unknown"
            ]
          },
          "tax_cents": {
            "type": [
              "integer",
              "null"
            ]
          },
          "recurring_fees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NormalizedFee"
            }
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NormalizedItem"
            }
          },
          "fees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NormalizedFee"
            }
          },
          "requirement_results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RequirementResult"
            }
          },
          "evidence_checks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvidenceCheck"
            }
          },
          "purchase_review": {
            "$ref": "#/components/schemas/PurchaseReview"
          }
        }
      },
      "RevisionChange": {
        "type": "object",
        "required": [
          "path",
          "before",
          "after",
          "sources"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "before": {},
          "after": {},
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Source"
            }
          }
        }
      },
      "RevisionReport": {
        "type": "object",
        "required": [
          "schema_version",
          "service",
          "change_count",
          "changes",
          "upfront_change_cents",
          "currency",
          "before_review",
          "after_review",
          "summary",
          "limitations",
          "billing",
          "receipt"
        ],
        "properties": {
          "schema_version": {
            "const": "0.4.18"
          },
          "service": {
            "type": "string"
          },
          "change_count": {
            "type": "integer",
            "minimum": 0
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RevisionChange"
            }
          },
          "upfront_change_cents": {
            "type": [
              "integer",
              "null"
            ]
          },
          "currency": {
            "type": "string"
          },
          "before_review": {
            "$ref": "#/components/schemas/QuoteReview"
          },
          "after_review": {
            "$ref": "#/components/schemas/QuoteReview"
          },
          "summary": {
            "type": "string"
          },
          "limitations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "billing": {
            "type": "object",
            "required": [
              "charged",
              "mode"
            ],
            "properties": {
              "charged": {
                "const": false
              },
              "mode": {
                "const": "free_preview"
              }
            }
          },
          "receipt": {
            "$ref": "#/components/schemas/Receipt"
          }
        }
      },
      "Requirements": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/Requirement"
            }
          }
        },
        "additionalProperties": false,
        "description": "Only items is supported. Buyer-wide budget, shipping, or approval constraints must not be supplied as if enforced by this preview; unsupported fields return 422."
      }
    },
    "securitySchemes": {
      "RecoveryCode": {
        "type": "http",
        "scheme": "bearer",
        "description": "Random 32-byte (64 lowercase hex) client-generated recovery secret. Not a wallet key. Keep out of URLs and logs."
      }
    }
  }
}
