{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://runbooks.directory/spec/v1/schema/run-report-envelope.json",
  "title": "Run report, CloudEvents envelope",
  "description": "The event binding for a run report (RUNBOOK.md 14). A runner already emitting lineage events adds one mapping rather than a new pipeline, which is the whole reason the format is event-shaped. The envelope carries no field the report itself excludes: in particular `source` is a URI naming a kind of producer, not an installation, and `time` is not required - a precise emission time reintroduces exactly the movement log that bucketing the duration was meant to avoid.",
  "type": "object",
  "additionalProperties": false,
  "required": ["specversion", "type", "source", "id", "datacontenttype", "data"],
  "properties": {
    "specversion": { "const": "1.0" },
    "type": { "const": "directory.runbooks.run-report.v1" },
    "source": {
      "type": "string",
      "pattern": "^urn:runbooks:(cli|hook|proxy|other)$",
      "description": "What kind of thing produced this, from a closed set. A free-form source is a hostname waiting to happen."
    },
    "id": {
      "type": "string",
      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
      "description": "A per-event UUID for deduplication. Not a sender identity, and not stable across runs: correlating two reports to one reporter is the thing this format refuses to enable."
    },
    "datacontenttype": { "const": "application/json" },
    "data": { "$ref": "https://runbooks.directory/spec/v1/schema/run-report.json" }
  }
}
