{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Stageframe normalized event V1",
  "type": "object",
  "additionalProperties": false,
  "required": ["event_id", "event_type", "event_version", "event_timestamp", "workspace_id", "system_id", "source", "data", "metadata"],
  "properties": {
    "event_id": { "type": "string", "minLength": 1 },
    "event_type": { "enum": ["system.connected", "system.disconnected", "system.health.degraded", "system.health.restored", "system.error", "agent.registered", "agent.updated", "agent.state.changed", "run.started", "run.progress", "run.completed", "run.failed", "run.cancelled", "step.started", "step.progress", "step.completed", "step.failed", "tool.started", "tool.completed", "tool.failed", "artifact.created", "artifact.updated", "artifact.deleted", "approval.requested", "approval.resolved", "approval.expired", "attention.raised", "attention.resolved", "interaction.received", "interaction.responded", "interaction.failed"] },
    "event_version": { "const": "1.0" },
    "event_timestamp": { "type": "string", "format": "date-time" },
    "workspace_id": { "type": "string", "minLength": 1 },
    "system_id": { "type": "string", "minLength": 1 },
    "agent_id": { "type": "string", "minLength": 1 },
    "run_id": { "type": "string", "minLength": 1 },
    "step_id": { "type": "string", "minLength": 1 },
    "artifact_id": { "type": "string", "minLength": 1 },
    "approval_id": { "type": "string", "minLength": 1 },
    "source": {
      "type": "object", "additionalProperties": false,
      "required": ["provider", "integration_id", "provider_event_id"],
      "properties": {
        "provider": { "type": "string", "minLength": 1 },
        "integration_id": { "type": "string", "minLength": 1 },
        "provider_event_id": { "type": "string", "minLength": 1 }
      }
    },
    "data": { "type": "object" },
    "metadata": { "type": "object" }
  }
}
