{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.dharma-ai.io/protocol-envelope/v1",
  "title": "Relay Protocol Envelope",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "messageId",
    "organizationId",
    "deviceId",
    "sessionId",
    "sentAt",
    "expiresAt",
    "sequence",
    "nonce",
    "type",
    "payload",
    "signature"
  ],
  "properties": {
    "schema": {
      "const": "dharma.protocol-envelope/v1"
    },
    "messageId": {
      "type": "string",
      "format": "uuid"
    },
    "organizationId": {
      "type": "string",
      "minLength": 1
    },
    "deviceId": {
      "type": "string",
      "minLength": 1
    },
    "sessionId": {
      "type": "string",
      "minLength": 1
    },
    "sentAt": {
      "type": "string",
      "format": "date-time"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "sequence": {
      "type": "integer",
      "minimum": 0
    },
    "nonce": {
      "type": "string",
      "minLength": 1
    },
    "type": {
      "type": "string"
    },
    "payload": {
      "type": "object"
    },
    "signature": {
      "type": "string",
      "minLength": 1
    }
  }
}
