{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/machineeconomyobservatory-com/json-schema/machineeconomyobservatory-com-preflight-result-schema.json",
  "title": "PreflightResult",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/machineeconomyobservatory-com-openapi.json#/components/schemas/PreflightResult",
  "type": "object",
  "properties": {
    "request_id": {
      "type": "string",
      "format": "uuid"
    },
    "version": {
      "const": "0.1.0"
    },
    "result_state": {
      "type": "string",
      "enum": [
        "HISTORICAL_CONTEXT",
        "MATERIAL_DIFFERENCE",
        "UNKNOWN",
        "UNSUPPORTED"
      ]
    },
    "evidence_outcome": {
      "const": "INSUFFICIENT_EVIDENCE"
    },
    "match_status": {
      "type": "string",
      "enum": [
        "EXACT_RESOURCE",
        "UNRESOLVED"
      ]
    },
    "resolved_service": {
      "anyOf": [
        {
          "type": "null"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "resource": {
              "type": "string",
              "format": "uri"
            }
          },
          "required": [
            "id",
            "name",
            "resource"
          ],
          "additionalProperties": false
        }
      ]
    },
    "economic_history": {
      "type": "object",
      "properties": {
        "state": {
          "type": "string",
          "enum": [
            "PAYMENT_TERMS_OBSERVED",
            "UNKNOWN"
          ]
        },
        "settlement_state": {
          "const": "UNKNOWN"
        },
        "observation_count": {
          "type": "integer",
          "minimum": 0
        },
        "payment_term_observation_count": {
          "type": "integer",
          "minimum": 0
        },
        "history_change_state": {
          "type": "string",
          "enum": [
            "UNKNOWN",
            "CHANGE_OBSERVED",
            "NO_CHANGE_IN_CAPTURED_TERMS"
          ]
        },
        "payment_destination_history": {
          "const": "UNKNOWN"
        }
      },
      "required": [
        "state",
        "settlement_state",
        "observation_count",
        "payment_term_observation_count",
        "history_change_state",
        "payment_destination_history"
      ],
      "additionalProperties": false
    },
    "current_activity": {
      "type": "object",
      "properties": {
        "state": {
          "const": "UNKNOWN"
        },
        "last_reported_status": {
          "type": [
            "string",
            "null"
          ]
        },
        "observed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      },
      "required": [
        "state",
        "last_reported_status",
        "observed_at"
      ],
      "additionalProperties": false
    },
    "material_findings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "payment_term_comparisons": {
      "type": "object",
      "properties": {
        "network": {
          "type": "string",
          "enum": [
            "UNKNOWN",
            "MATCH",
            "DIFFERENT_FROM_OBSERVED"
          ]
        },
        "asset": {
          "type": "string",
          "enum": [
            "UNKNOWN",
            "MATCH",
            "DIFFERENT_FROM_OBSERVED"
          ]
        },
        "amount": {
          "type": "string",
          "enum": [
            "UNKNOWN",
            "WITHIN_OBSERVED_RANGE",
            "OUTSIDE_OBSERVED_RANGE"
          ]
        },
        "payTo": {
          "type": "string",
          "enum": [
            "UNKNOWN",
            "MATCH",
            "DIFFERENT_FROM_OBSERVED"
          ]
        },
        "observed_terms": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "properties": {
                "networks": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "asset": {
                  "type": "string"
                },
                "amount_min": {
                  "type": "string"
                },
                "amount_max": {
                  "type": "string"
                },
                "payTo": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "networks",
                "asset",
                "amount_min",
                "amount_max",
                "payTo"
              ],
              "additionalProperties": false
            }
          ]
        },
        "observed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "amount_unit": {
          "const": "decimal_asset_units"
        },
        "basis": {
          "const": "LAST_CAPTURED_TERMS_ONLY"
        }
      },
      "required": [
        "network",
        "asset",
        "amount",
        "payTo",
        "observed_terms",
        "observed_at",
        "amount_unit",
        "basis"
      ],
      "additionalProperties": false
    },
    "evidence_freshness": {
      "type": "object",
      "properties": {
        "state": {
          "type": "string",
          "enum": [
            "UNKNOWN",
            "RECENT_SNAPSHOT",
            "STALE"
          ]
        },
        "latest_observed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "retrieved_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "age_seconds": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "stale_after_seconds": {
          "const": 86400
        }
      },
      "required": [
        "state",
        "latest_observed_at",
        "retrieved_at",
        "age_seconds",
        "stale_after_seconds"
      ],
      "additionalProperties": false
    },
    "evidence_confidence": {
      "type": "object",
      "properties": {
        "strength": {
          "type": "string",
          "enum": [
            "LIMITED",
            "NONE"
          ]
        },
        "basis": {
          "type": "string",
          "enum": [
            "SINGLE_THIRD_PARTY_SOURCE_UNVERIFIED",
            "NO_MATCHING_PUBLIC_EVIDENCE"
          ]
        }
      },
      "required": [
        "strength",
        "basis"
      ],
      "additionalProperties": false
    },
    "evidence": {
      "type": "object",
      "properties": {
        "snapshot_id": {
          "type": "string"
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "required": [
        "snapshot_id",
        "sources"
      ],
      "additionalProperties": false
    },
    "limitations": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "request_id",
    "version",
    "result_state",
    "evidence_outcome",
    "match_status",
    "resolved_service",
    "economic_history",
    "current_activity",
    "material_findings",
    "payment_term_comparisons",
    "evidence_freshness",
    "evidence_confidence",
    "evidence",
    "limitations"
  ],
  "additionalProperties": false
}