{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:architecture-standards:schema:event-envelope",
  "title": "Event envelope",
  "description": "Structural projection of the common fields of a project event.",
  "$comment": "Nonnormative projection of INT-EVT-001 and INT-EVT-004. Normative text prevails. Project payload constraints belong to the versioned project event schema.",
  "type": "object",
  "required": [
    "timestamp",
    "event.id",
    "event.name",
    "event.schema_version",
    "producer.id"
  ],
  "properties": {
    "timestamp": {
      "type": "string",
      "format": "date-time"
    },
    "event.id": {
      "type": "string",
      "pattern": "\\S"
    },
    "event.name": {
      "type": "string",
      "pattern": "\\S"
    },
    "event.schema_version": {
      "type": "integer",
      "minimum": 1
    },
    "producer.id": {
      "type": "string",
      "pattern": "\\S"
    },
    "trace_id": {
      "type": "string",
      "pattern": "^[0-9a-f]{32}$",
      "not": {
        "const": "00000000000000000000000000000000"
      }
    },
    "span_id": {
      "type": "string",
      "pattern": "^[0-9a-f]{16}$",
      "not": {
        "const": "0000000000000000"
      }
    },
    "correlation_id": {
      "type": "string",
      "pattern": "\\S"
    },
    "payload": true
  },
  "dependentRequired": {
    "trace_id": [
      "span_id"
    ],
    "span_id": [
      "trace_id"
    ]
  },
  "additionalProperties": true
}
