{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Nova CloudEvents 1.0 Envelope",
  "description": "CloudEvents 1.0 envelope with Nova platform.* semantic conventions. Used for all metrics events (REQ-187).",
  "type": "object",
  "required": ["specversion", "id", "source", "type", "time", "datacontenttype", "platform", "data"],
  "properties": {
    "specversion": {"type": "string", "const": "1.0"},
    "id": {"type": "string", "minLength": 1},
    "source": {"type": "string", "minLength": 1},
    "type": {"type": "string", "minLength": 1, "pattern": "^nova\\."},
    "time": {"type": "string", "format": "date-time"},
    "subject": {"type": "string"},
    "datacontenttype": {"type": "string", "const": "application/json"},
    "platform": {
      "type": "object",
      "required": ["run_id", "environment"],
      "properties": {
        "tenant_id": {"type": "string"},
        "run_id": {"type": "string", "minLength": 1},
        "contract_id": {"type": "string"},
        "environment": {"type": "string", "enum": ["dev", "qa", "prod", "dr"]},
        "actor": {
          "type": "object",
          "properties": {
            "type": {"type": "string"},
            "id": {"type": "string"}
          }
        },
        "trace_id": {"type": "string"}
      }
    },
    "data": {"type": "object"}
  },
  "additionalProperties": true
}