{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://protocol.nivalo.io/schemas/v1.1/mqtt-envelope.schema.json",
  "title": "Nivalo v1.1 MQTT envelope",
  "description": "Every v1.1 MQTT payload. correlationId is required on commands/{id}, ota/{id} and both ACK routes and equals the route ID; it is absent elsewhere. firmware is required on availability birth and absent elsewhere. The payload schema is selected by the topic.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "messageId", "deviceId", "sentAt", "payload"],
  "properties": {
    "schema": { "const": "nivalo.iot.v1.1" },
    "messageId": { "$ref": "common.schema.json#/$defs/uuid" },
    "deviceId": { "$ref": "common.schema.json#/$defs/uuid" },
    "sentAt": { "$ref": "common.schema.json#/$defs/utc" },
    "correlationId": { "$ref": "common.schema.json#/$defs/uuid" },
    "firmware": { "$ref": "common.schema.json#/$defs/firmware" },
    "payload": { "type": "object" }
  }
}
