{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "installationId",
    "modules"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "installationId": {
      "$ref": "#/$defs/d0_installationId"
    },
    "modules": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/d1_publicModuleSnapshot"
      }
    }
  },
  "$defs": {
    "d0_installationId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "d2_dateTime": {
      "type": "string",
      "format": "date-time"
    },
    "d1_publicModuleSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "instanceId",
        "moduleType",
        "driverId",
        "moduleVersion",
        "schemaVersion",
        "state",
        "observedAt",
        "provenance",
        "health",
        "data"
      ],
      "properties": {
        "instanceId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "moduleType": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "driverId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "moduleVersion": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$"
        },
        "schemaVersion": {
          "type": "integer",
          "minimum": 1
        },
        "state": {
          "enum": [
            "disabled",
            "starting",
            "ready",
            "degraded",
            "faulted",
            "stopped"
          ]
        },
        "observedAt": {
          "$ref": "#/$defs/d2_dateTime"
        },
        "provenance": {
          "enum": [
            "hardware",
            "simulated",
            "replay",
            "derived"
          ]
        },
        "health": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "checkedAt"
          ],
          "properties": {
            "message": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 512
            },
            "code": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 128
            },
            "checkedAt": {
              "$ref": "#/$defs/d2_dateTime"
            }
          }
        },
        "data": {
          "type": "object"
        }
      }
    }
  },
  "$comment": "Public response structure from source snapshot 9e38b9313c9b4926ad15c7cd691d7f5789bdbc55. See endpoint notes for semantic constraints."
}
