{
  "type": "record",
  "namespace": "yelp.data_pipeline",
  "name": "envelope",
  "doc": "Wraps message with schema format for decoding and pipeline metadata.",
  "fields": [
    {
      "name": "uuid",
      "type": {
        "name": "uuid",
        "type": "fixed",
        "size": 16
      },
      "doc": "Uniquely identifies the message."
    },
    {
      "name": "message_type",
      "type": {
        "name": "message_type",
        "type": "enum",
        "doc": "Enumeration for possible types of message, these are used as values for data_pipeline.message_type.MessageType.",
        "symbols": [
          "create",
          "update",
          "delete",
          "refresh",
          "heartbeat",
          "monitor",
          "registration",
          "log"
        ]
      },
      "doc": "Identifies the type of message.  Refresh messages are used to bootstrap topics and can be safely ignored by consumers that only care about data updates.  Heartbeats will be emitted periodically on topics without other messages to facilitate auditing - they will not be passed to the consumer."
    },
    {
      "name": "schema_id",
      "type": "int",
      "doc": "Schema identifier for the payload."
    },
    {
      "name": "payload",
      "type": "bytes",
      "doc": "Avro-encoded data encoded with the schema corresponding to schema_id"
    },
    {
      "name": "previous_payload",
      "type": [
        "null",
        "bytes"
      ],
      "doc": "Avro-encoded state of the row prior to the update for update messages."
    },
    {
      "name": "meta",
      "type": [
        "null",
        {
          "type": "array",
          "items": {
            "type": "record",
            "name": "meta_envelope",
            "doc": "Record to encode and pipeline each meta_attribute in data_pipeline message.",
            "fields": [
              {
                "name": "schema_id",
                "type": "int",
                "doc": "Schema identifier for the meta-attribute payload."
              },
              {
                "name": "payload",
                "type": "bytes",
                "doc": "Avro-encoded data encoded with the schema corresponding to schema_id"
              }
            ]
          }
        }
      ],
      "doc": "List of record containing schema_id and encoded payloads for meta-attributes."
    },
    {
      "name": "encryption_type",
      "type": [
        "null",
        "string"
      ],
      "doc": "If encryption is used, identifies the type and key used to encrypt the payload."
    },
    {
      "name": "timestamp",
      "type": "int",
      "doc": "Time the message was produced."
    }
  ]
}
