{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://slowsystems.app/proof/schema/cognitive-state-update.schema.json",
  "title": "SlowSystems Cognitive State Update Event",
  "description": "Draft non-medical derived-event schema for SlowSystems Neuro reviewer discussions. This schema is not a live-device, compatibility, endorsement, clinical, diagnostic, treatment, or vendor-approval claim.",
  "type": "object",
  "required": [
    "event_type",
    "schema_version",
    "runtime_status",
    "input",
    "signal_quality",
    "features",
    "output"
  ],
  "additionalProperties": false,
  "properties": {
    "event_type": {
      "const": "cognitive_state_update"
    },
    "schema_version": {
      "type": "string",
      "pattern": "^0\\.[0-9]+-draft$"
    },
    "runtime_status": {
      "type": "string",
      "enum": [
        "simulated_fixture_only_live_device_artifact_pending",
        "architecture_schema_available_live_device_artifact_pending",
        "approved_stream_runtime_artifact_available"
      ]
    },
    "input": {
      "type": "object",
      "required": [
        "source_type",
        "vendor_specific_source",
        "sampling_window_ms"
      ],
      "additionalProperties": false,
      "properties": {
        "source_type": {
          "type": "string",
          "enum": [
            "simulator_fixture",
            "approved_stream",
            "open_platform_runtime"
          ]
        },
        "source_name": {
          "type": "string",
          "maxLength": 120
        },
        "vendor_specific_source": {
          "type": "boolean"
        },
        "sampling_window_ms": {
          "type": "integer",
          "minimum": 500,
          "maximum": 30000
        },
        "sampling_rate_hz": {
          "type": "number",
          "minimum": 1,
          "maximum": 4096
        }
      }
    },
    "signal_quality": {
      "type": "object",
      "required": [
        "status",
        "artifact_flags"
      ],
      "additionalProperties": false,
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "usable",
            "limited",
            "rejected"
          ]
        },
        "artifact_flags": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "dropout_ratio": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      }
    },
    "features": {
      "type": "object",
      "required": [
        "alpha_relative",
        "theta_relative",
        "beta_relative"
      ],
      "additionalProperties": false,
      "properties": {
        "alpha_relative": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "theta_relative": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "beta_relative": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "delta_relative": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "gamma_relative": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      }
    },
    "output": {
      "type": "object",
      "required": [
        "state_label",
        "confidence_mode",
        "claim_boundary"
      ],
      "additionalProperties": false,
      "properties": {
        "state_label": {
          "type": "string",
          "enum": [
            "focused_calm",
            "attention_shift",
            "workload_high",
            "signal_unusable",
            "unknown"
          ]
        },
        "confidence_mode": {
          "type": "string",
          "enum": [
            "prototype_only",
            "review_only",
            "not_validated_for_clinical_use"
          ]
        },
        "claim_boundary": {
          "const": "non_medical"
        }
      }
    }
  }
}
