{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/clment-com/json-schema/clment-com-upload-result-schema.json",
  "title": "UploadResult",
  "description": "The result of an upload. Two outcomes share this shape: a NEW contract returns 202 with `jobId` to poll, while a file matched to an existing contract returns 200 with `attached: true` and the contract it was filed under. Test `jobId` to tell them apart.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/clment-com-openapi.yml#/components/schemas/UploadResult",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "jobId": {
          "type": "string",
          "description": "Present on 202. Poll `GET /contracts/upload/jobs/{jobId}` until it reports complete, then read the contract it names."
        },
        "matchedContractId": {
          "type": [
            "string",
            "null"
          ],
          "description": "Non-null when the file matched an existing contract on the `new` path."
        },
        "matchedContractTitle": {
          "type": [
            "string",
            "null"
          ]
        },
        "attached": {
          "type": "boolean",
          "description": "Present and true on 200 — the file became a new version of an existing contract."
        },
        "contractId": {
          "type": "string",
          "description": "On 200, the contract the file was filed under."
        },
        "contractTitle": {
          "type": "string"
        },
        "version": {
          "type": "object",
          "description": "On 200, the version the file became.",
          "properties": {
            "id": {
              "type": "string"
            },
            "versionNumber": {
              "type": "integer"
            },
            "label": {
              "type": "string"
            },
            "fileName": {
              "type": "string"
            },
            "fileSize": {
              "type": "integer"
            }
          }
        },
        "revisionSummary": {
          "type": [
            "string",
            "null"
          ],
          "description": "Present when summariseChanges was set."
        }
      }
    }
  }
}