class ShardedMessageEnvelope implements Jsonifiable<JsonObject>, WithDittoHeaders<ShardedMessageEnvelope>, WithId {

    public static ShardedMessageEnvelope fromJson(final JsonObject jsonObject) {
        final String extractedId = jsonObject.getValueOrThrow(JSON_ID);
        final EntityId entityId = DefaultEntityId.of(extractedId);
        final String extractedType = jsonObject.getValueOrThrow(JSON_TYPE);
        final JsonObject extractedMessage = jsonObject.getValueOrThrow(JSON_MESSAGE);
        final JsonObject jsonDittoHeaders = jsonObject.getValueOrThrow(JSON_DITTO_HEADERS);
        final DittoHeaders extractedDittoHeaders = DittoHeaders.newBuilder(jsonDittoHeaders).build();

        return of(entityId, extractedType, extractedMessage, extractedDittoHeaders);
    }

    private  ShardedMessageEnvelope(final EntityId id,
            final String type,
            final JsonObject message,
            final DittoHeaders dittoHeaders);

}