{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/flaresignal-io/json-schema/flaresignal-io-machine-response-schema.json",
  "title": "MachineResponse",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/flaresignal-io-openapi.json#/components/schemas/MachineResponse",
  "type": "object",
  "required": [
    "schema_version",
    "capability_id",
    "capability_version",
    "request_id",
    "generated_at",
    "state",
    "data",
    "truth",
    "assurance",
    "access"
  ],
  "properties": {
    "schema_version": {
      "const": "flaresignal.machine.v1"
    },
    "capability_id": {
      "type": "string"
    },
    "capability_version": {
      "type": "string"
    },
    "request_id": {
      "type": "string"
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "state": {
      "type": "string"
    },
    "data": {
      "type": "object"
    },
    "truth": {
      "type": "object"
    },
    "assurance": {
      "$ref": "#/$defs/MachineAssurance"
    },
    "access": {
      "type": "object"
    },
    "payment": []
  },
  "$defs": {
    "MachineAssurance": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "https://flaresignal.io/schemas/machine-assurance-v1.schema.json",
      "title": "FlareSignal Machine Assurance v1",
      "type": "object",
      "required": [
        "schema_version",
        "version",
        "provenance",
        "freshness",
        "confidence",
        "units",
        "historical_completeness",
        "policy"
      ],
      "properties": {
        "schema_version": {
          "const": "flaresignal.machine-assurance.v1"
        },
        "version": {
          "type": "string"
        },
        "provenance": {
          "type": "object",
          "required": [
            "canonicality",
            "source_count",
            "sources",
            "evidence_count",
            "metric_keys",
            "dataset_ids"
          ]
        },
        "freshness": {
          "type": "object",
          "required": [
            "state",
            "age_seconds",
            "max_age_seconds",
            "observed_at",
            "source_timestamp"
          ]
        },
        "confidence": {
          "type": "object",
          "required": [
            "level",
            "basis",
            "limitations",
            "probabilistic"
          ],
          "properties": {
            "level": {
              "enum": [
                "high",
                "moderate",
                "limited",
                "unavailable"
              ]
            },
            "basis": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "limitations": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "probabilistic": {
              "const": false
            }
          }
        },
        "units": {
          "type": "object",
          "required": [
            "declared",
            "observed"
          ]
        },
        "historical_completeness": {
          "type": "object",
          "required": [
            "state",
            "relevance",
            "requested_range",
            "datasets",
            "metrics",
            "limitations"
          ]
        },
        "policy": {
          "type": "object"
        }
      }
    }
  }
}