{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/krimskrams-xyz/json-schema/krimskrams-xyz-change-intelligence-response-schema.json",
  "title": "ChangeIntelligenceResponse",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/grant-search_krimskrams_xyz_openapi.json#/components/schemas/ChangeIntelligenceResponse",
  "properties": {
    "cursor": {
      "anyOf": [
        {
          "$ref": "#/$defs/EventCursorResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_cursor": {
      "anyOf": [
        {
          "$ref": "#/$defs/EventCursorResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "next_request": {
      "anyOf": [
        {
          "$ref": "#/$defs/ChangeIntelligenceContinuationResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "has_more": {
      "type": "boolean",
      "title": "Has More"
    },
    "truncation_reason": {
      "type": "string",
      "enum": [
        "none",
        "event_limit",
        "response_byte_limit"
      ],
      "title": "Truncation Reason"
    },
    "event_limit": {
      "type": "integer",
      "title": "Event Limit"
    },
    "response_byte_limit": {
      "type": "integer",
      "title": "Response Byte Limit"
    },
    "response_bytes": {
      "type": "integer",
      "title": "Response Bytes"
    },
    "processed_event_count": {
      "type": "integer",
      "title": "Processed Event Count"
    },
    "as_of": {
      "type": "string",
      "format": "date-time",
      "title": "As Of"
    },
    "window_days": {
      "type": "integer",
      "title": "Window Days"
    },
    "scope": {
      "additionalProperties": true,
      "type": "object",
      "title": "Scope"
    },
    "collection_scope": {
      "$ref": "#/$defs/CollectionScopeResponse"
    },
    "dataset_status": {
      "$ref": "#/$defs/DatasetStatusResponse"
    },
    "event_count": {
      "type": "integer",
      "title": "Event Count"
    },
    "events": {
      "items": {
        "$ref": "#/$defs/HistoryEventResponse"
      },
      "type": "array",
      "title": "Events"
    },
    "risk_count": {
      "type": "integer",
      "title": "Risk Count"
    },
    "risks": {
      "items": {
        "$ref": "#/$defs/DeadlineRiskResponse"
      },
      "type": "array",
      "title": "Risks"
    },
    "award_value_change_count": {
      "type": "integer",
      "title": "Award Value Change Count"
    },
    "award_value_changes": {
      "items": {
        "$ref": "#/$defs/AwardValueChangeResponse"
      },
      "type": "array",
      "title": "Award Value Changes"
    }
  },
  "type": "object",
  "required": [
    "cursor",
    "next_cursor",
    "next_request",
    "has_more",
    "truncation_reason",
    "event_limit",
    "response_byte_limit",
    "response_bytes",
    "processed_event_count",
    "as_of",
    "window_days",
    "scope",
    "collection_scope",
    "dataset_status",
    "event_count",
    "events",
    "risk_count",
    "risks",
    "award_value_change_count",
    "award_value_changes"
  ],
  "$defs": {
    "AwardValueChangeResponse": {
      "properties": {
        "snapshot_id": {
          "type": "integer",
          "title": "Snapshot Id"
        },
        "captured_at": {
          "type": "string",
          "format": "date-time",
          "title": "Captured At"
        },
        "opportunity_id": {
          "type": "integer",
          "title": "Opportunity Id"
        },
        "field_name": {
          "type": "string",
          "title": "Field Name"
        },
        "change_type": {
          "type": "string",
          "title": "Change Type"
        },
        "direction": {
          "type": "string",
          "title": "Direction"
        },
        "old_value": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Old Value"
        },
        "new_value": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "New Value"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "agency_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Agency Name"
        },
        "status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Status"
        },
        "source_api": {
          "type": "string",
          "title": "Source Api"
        },
        "source_updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Source Updated At"
        },
        "evidence_url": {
          "type": "string",
          "title": "Evidence Url"
        },
        "payload_sha256": {
          "type": "string",
          "title": "Payload Sha256"
        }
      },
      "type": "object",
      "required": [
        "snapshot_id",
        "captured_at",
        "opportunity_id",
        "field_name",
        "change_type",
        "direction",
        "old_value",
        "new_value",
        "title",
        "agency_name",
        "status",
        "source_api",
        "source_updated_at",
        "evidence_url",
        "payload_sha256"
      ],
      "title": "AwardValueChangeResponse"
    },
    "ChangeIntelligenceContinuationResponse": {
      "properties": {
        "scope": {
          "type": "string",
          "title": "Scope"
        },
        "cursor": {
          "type": "string",
          "title": "Cursor"
        },
        "end_cursor": {
          "type": "string",
          "title": "End Cursor"
        },
        "end_snapshot_id": {
          "type": "integer",
          "title": "End Snapshot Id"
        },
        "as_of": {
          "type": "string",
          "format": "date-time",
          "title": "As Of"
        },
        "window_days": {
          "type": "integer",
          "title": "Window Days"
        },
        "event_limit": {
          "type": "integer",
          "title": "Event Limit"
        }
      },
      "type": "object",
      "required": [
        "scope",
        "cursor",
        "end_cursor",
        "end_snapshot_id",
        "as_of",
        "window_days",
        "event_limit"
      ],
      "title": "ChangeIntelligenceContinuationResponse"
    },
    "CollectionScopeResponse": {
      "properties": {
        "configured": {
          "type": "boolean",
          "title": "Configured"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Name"
        }
      },
      "type": "object",
      "required": [
        "configured",
        "name"
      ],
      "title": "CollectionScopeResponse"
    },
    "DatasetStatusResponse": {
      "properties": {
        "found": {
          "type": "boolean",
          "title": "Found"
        },
        "first_snapshot_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "First Snapshot Id"
        },
        "first_captured_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "First Captured At"
        },
        "latest_snapshot_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Latest Snapshot Id"
        },
        "latest_captured_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Latest Captured At"
        },
        "snapshot_count": {
          "type": "integer",
          "title": "Snapshot Count"
        },
        "latest_record_count": {
          "type": "integer",
          "title": "Latest Record Count"
        },
        "total_observation_count": {
          "type": "integer",
          "title": "Total Observation Count"
        },
        "distinct_opportunity_count": {
          "type": "integer",
          "title": "Distinct Opportunity Count"
        },
        "field_change_count": {
          "type": "integer",
          "title": "Field Change Count"
        },
        "source_api": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Source Api"
        },
        "freshness_age_seconds": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Freshness Age Seconds"
        }
      },
      "type": "object",
      "required": [
        "found",
        "first_snapshot_id",
        "first_captured_at",
        "latest_snapshot_id",
        "latest_captured_at",
        "snapshot_count",
        "latest_record_count",
        "total_observation_count",
        "distinct_opportunity_count",
        "field_change_count",
        "source_api",
        "freshness_age_seconds"
      ],
      "title": "DatasetStatusResponse"
    },
    "DeadlineRiskResponse": {
      "properties": {
        "snapshot_id": {
          "type": "integer",
          "title": "Snapshot Id"
        },
        "captured_at": {
          "type": "string",
          "format": "date-time",
          "title": "Captured At"
        },
        "opportunity_id": {
          "type": "integer",
          "title": "Opportunity Id"
        },
        "risk_type": {
          "type": "string",
          "title": "Risk Type"
        },
        "deadline": {
          "type": "string",
          "format": "date",
          "title": "Deadline"
        },
        "days_remaining": {
          "type": "integer",
          "title": "Days Remaining"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "agency_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Agency Name"
        },
        "status": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Status"
        },
        "event_type": {
          "type": "string",
          "title": "Event Type"
        },
        "trigger_field": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Trigger Field"
        },
        "old_value": {
          "anyOf": [
            {},
            {
              "type": "null"
            }
          ],
          "title": "Old Value"
        },
        "new_value": {
          "anyOf": [
            {},
            {
              "type": "null"
            }
          ],
          "title": "New Value"
        },
        "source_api": {
          "type": "string",
          "title": "Source Api"
        },
        "source_updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Source Updated At"
        },
        "evidence_url": {
          "type": "string",
          "title": "Evidence Url"
        },
        "payload_sha256": {
          "type": "string",
          "title": "Payload Sha256"
        }
      },
      "type": "object",
      "required": [
        "snapshot_id",
        "captured_at",
        "opportunity_id",
        "risk_type",
        "deadline",
        "days_remaining",
        "title",
        "agency_name",
        "status",
        "event_type",
        "trigger_field",
        "old_value",
        "new_value",
        "source_api",
        "source_updated_at",
        "evidence_url",
        "payload_sha256"
      ],
      "title": "DeadlineRiskResponse"
    },
    "EventCursorResponse": {
      "properties": {
        "snapshot_id": {
          "type": "integer",
          "title": "Snapshot Id"
        },
        "opportunity_id": {
          "type": "integer",
          "title": "Opportunity Id"
        }
      },
      "type": "object",
      "required": [
        "snapshot_id",
        "opportunity_id"
      ],
      "title": "EventCursorResponse"
    },
    "FieldChangeResponse": {
      "properties": {
        "field_name": {
          "type": "string",
          "title": "Field Name"
        },
        "old_value": {
          "anyOf": [
            {},
            {
              "type": "null"
            }
          ],
          "title": "Old Value"
        },
        "new_value": {
          "anyOf": [
            {},
            {
              "type": "null"
            }
          ],
          "title": "New Value"
        }
      },
      "type": "object",
      "required": [
        "field_name",
        "old_value",
        "new_value"
      ],
      "title": "FieldChangeResponse"
    },
    "HistoryEventResponse": {
      "properties": {
        "snapshot_id": {
          "type": "integer",
          "title": "Snapshot Id"
        },
        "event_type": {
          "type": "string",
          "title": "Event Type"
        },
        "captured_at": {
          "type": "string",
          "format": "date-time",
          "title": "Captured At"
        },
        "opportunity_id": {
          "type": "integer",
          "title": "Opportunity Id"
        },
        "source_api": {
          "type": "string",
          "title": "Source Api"
        },
        "source_updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Source Updated At"
        },
        "evidence_url": {
          "type": "string",
          "title": "Evidence Url"
        },
        "payload_sha256": {
          "type": "string",
          "title": "Payload Sha256"
        },
        "payload": {
          "additionalProperties": true,
          "type": "object",
          "title": "Payload"
        },
        "changes": {
          "items": {
            "$ref": "#/$defs/FieldChangeResponse"
          },
          "type": "array",
          "title": "Changes"
        }
      },
      "type": "object",
      "required": [
        "snapshot_id",
        "event_type",
        "captured_at",
        "opportunity_id",
        "source_api",
        "source_updated_at",
        "evidence_url",
        "payload_sha256",
        "payload",
        "changes"
      ],
      "title": "HistoryEventResponse"
    }
  }
}