{
  "$id": "https://stella-ops.org/schemas/events/scanner.report.ready@1.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": ["eventId", "kind", "tenant", "ts", "scope", "payload"],
  "properties": {
    "eventId": {"type": "string", "format": "uuid"},
    "kind": {"const": "scanner.report.ready"},
    "tenant": {"type": "string"},
    "ts": {"type": "string", "format": "date-time"},
    "scope": {
      "type": "object",
      "required": ["repo", "digest"],
      "properties": {
        "namespace": {"type": "string"},
        "repo": {"type": "string"},
        "digest": {"type": "string"}
      }
    },
    "payload": {
      "type": "object",
      "required": ["verdict", "delta", "links"],
      "properties": {
        "verdict": {"enum": ["pass", "warn", "fail"]},
        "delta": {
          "type": "object",
          "properties": {
            "newCritical": {"type": "integer", "minimum": 0},
            "newHigh": {"type": "integer", "minimum": 0},
            "kev": {"type": "array", "items": {"type": "string"}}
          }
        },
        "links": {
          "type": "object",
          "properties": {
            "ui": {"type": "string", "format": "uri"},
            "rekor": {"type": "string", "format": "uri"}
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": false
}
