{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fastcrw-com/json-schema/fastcrw-com-change-tracking-result-schema.json",
  "title": "ChangeTrackingResult",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fastcrw-com-change-tracking-api-openapi.yml#/components/schemas/ChangeTrackingResult",
  "type": "object",
  "required": [
    "status",
    "contentHash"
  ],
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "same",
        "changed"
      ],
      "description": "Per-page status. Set-level new/removed are computed by the caller's reconciler."
    },
    "firstObservation": {
      "type": "boolean",
      "description": "True when no previous was supplied — caller maps to 'new'"
    },
    "contentHash": {
      "type": "string"
    },
    "snapshot": {
      "$ref": "#/$defs/ChangeTrackingSnapshot"
    },
    "diff": {
      "$ref": "#/$defs/ChangeDiff"
    },
    "judgment": {
      "$ref": "#/$defs/ChangeJudgment"
    },
    "tag": {
      "type": "string"
    },
    "truncated": {
      "type": "boolean"
    }
  },
  "$defs": {
    "ChangeDiff": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "description": "Unified markdown diff (gitDiff/mixed)"
        },
        "json": {
          "type": "object",
          "additionalProperties": true,
          "description": "Parse-diff AST (gitDiff-only) OR per-field path map {previous,current} (json/mixed)"
        }
      }
    },
    "ChangeJudgment": {
      "type": "object",
      "required": [
        "meaningful",
        "confidence",
        "reason"
      ],
      "properties": {
        "meaningful": {
          "type": "boolean"
        },
        "confidence": {
          "type": "string",
          "enum": [
            "low",
            "medium",
            "high"
          ]
        },
        "reason": {
          "type": "string"
        },
        "meaningfulChanges": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "added",
                  "removed",
                  "changed"
                ]
              },
              "before": {
                "type": "string"
              },
              "after": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "ChangeTrackingSnapshot": {
      "type": "object",
      "properties": {
        "markdown": {
          "type": "string",
          "description": "Present for gitDiff/mixed mode"
        },
        "json": {
          "type": "object",
          "additionalProperties": true,
          "description": "Present for json/mixed mode"
        },
        "contentHash": {
          "type": "string",
          "description": "Mode-aware hash; persist + supply on the next check"
        },
        "capturedAt": {
          "type": "string",
          "description": "Caller-stamped capture time, echoed untouched"
        }
      }
    }
  }
}