syntax = "proto3";
package E2E;

import "../Protocol/Protocol.proto";
import "../AICommon/AICommon.proto";
import "../Adv/Adv.proto";
import "../StatusAttributions/StatusAttributions.proto";
import "../CompanionReg/CompanionReg.proto";
import "../MmsRetry/MmsRetry.proto";

message AIQueryFanout {
    optional Protocol.MessageKey messageKey = 1;
    optional Message message = 2;
    optional int64 timestamp = 3;
}

message AIRichResponseMessage {
    optional AICommon.AIRichResponseMessageType messageType = 1;
    repeated AICommon.AIRichResponseSubMessage submessages = 2;
    optional AICommon.AIRichResponseUnifiedResponse unifiedResponse = 3;
    optional ContextInfo contextInfo = 4;
}

message MemberLabel {
    optional string label = 1;
    optional int64 labelTimestamp = 2;
}

message UrlTrackingMap {
    repeated UrlTrackingMapElement urlTrackingMapElements = 1;
    message UrlTrackingMapElement {
        optional string originalUrl = 1;
        optional string unconsentedUsersUrl = 2;
        optional string consentedUsersUrl = 3;
        optional uint32 cardIndex = 4;
    }
}

message ProcessedVideo {
    optional string directPath = 1;
    optional bytes fileSha256 = 2;
    optional uint32 height = 3;
    optional uint32 width = 4;
    optional uint64 fileLength = 5;
    optional uint32 bitrate = 6;
    optional VideoQuality quality = 7;
    repeated string capabilities = 8;
    enum VideoQuality {
        UNDEFINED = 0;
        LOW = 1;
        MID = 2;
        HIGH = 3;
    }
}

message LIDMigrationMappingSyncMessage {
    optional bytes encodedMappingPayload = 1;
}

message MediaNotifyMessage {
    optional string expressPathUrl = 1;
    optional bytes fileEncSha256 = 2;
    optional uint64 fileLength = 3;
}

message MessageSecretMessage {
    optional sfixed32 version = 1;
    optional bytes encIv = 2;
    optional bytes encPayload = 3;
}

message GroupMention {
    optional string groupJid = 1;
    optional string groupSubject = 2;
}

message ActionLink {
    optional string url = 1;
    optional string buttonTitle = 2;
}

message DisappearingMode {
    optional Initiator initiator = 1;
    optional Trigger trigger = 2;
    optional string initiatorDeviceJid = 3;
    optional bool initiatedByMe = 4;
    enum Initiator {
        CHANGED_IN_CHAT = 0;
        INITIATED_BY_ME = 1;
        INITIATED_BY_OTHER = 2;
        BIZ_UPGRADE_FB_HOSTING = 3;
    }
    enum Trigger {
        UNKNOWN = 0;
        CHAT_SETTING = 1;
        ACCOUNT_SETTING = 2;
        BULK_CHANGE = 3;
        BIZ_SUPPORTS_FB_HOSTING = 4;
        UNKNOWN_GROUPS = 5;
    }
}

message PaymentBackground {
    optional string id = 1;
    optional uint64 fileLength = 2;
    optional uint32 width = 3;
    optional uint32 height = 4;
    optional string mimetype = 5;
    optional fixed32 placeholderArgb = 6;
    optional fixed32 textArgb = 7;
    optional fixed32 subtextArgb = 8;
    optional MediaData mediaData = 9;
    optional Type type = 10;
    message MediaData {
        optional bytes mediaKey = 1;
        optional int64 mediaKeyTimestamp = 2;
        optional bytes fileSha256 = 3;
        optional bytes fileEncSha256 = 4;
        optional string directPath = 5;
    }
    enum Type {
        UNKNOWN = 0;
        DEFAULT = 1;
    }
}

message Money {
    optional int64 value = 1;
    optional uint32 offset = 2;
    optional string currencyCode = 3;
}

message HydratedTemplateButton {
    optional uint32 index = 4;
    oneof hydratedButton {
        HydratedTemplateButton.HydratedQuickReplyButton quickReplyButton = 1;
        HydratedTemplateButton.HydratedURLButton urlButton = 2;
        HydratedTemplateButton.HydratedCallButton callButton = 3;
    }
    message HydratedCallButton {
        optional string displayText = 1;
        optional string phoneNumber = 2;
    }
    message HydratedQuickReplyButton {
        optional string displayText = 1;
        optional string id = 2;
    }
    message HydratedURLButton {
        optional string displayText = 1;
        optional string url = 2;
        optional string consentedUsersUrl = 3;
        optional WebviewPresentationType webviewPresentation = 4;
        enum WebviewPresentationType {
            FULL = 1;
            TALL = 2;
            COMPACT = 3;
        }
    }
}

message TemplateButton {
    optional uint32 index = 4;
    oneof button {
        TemplateButton.QuickReplyButton quickReplyButton = 1;
        TemplateButton.URLButton urlButton = 2;
        TemplateButton.CallButton callButton = 3;
    }
    message CallButton {
        optional Message.HighlyStructuredMessage displayText = 1;
        optional Message.HighlyStructuredMessage phoneNumber = 2;
    }
    message QuickReplyButton {
        optional Message.HighlyStructuredMessage displayText = 1;
        optional string id = 2;
    }
    message URLButton {
        optional Message.HighlyStructuredMessage displayText = 1;
        optional Message.HighlyStructuredMessage url = 2;
    }
}

message Location {
    optional double degreesLatitude = 1;
    optional double degreesLongitude = 2;
    optional string name = 3;
}

message Point {
    optional int32 xDeprecated = 1;
    optional int32 yDeprecated = 2;
    optional double x = 3;
    optional double y = 4;
}

message InteractiveAnnotation {
    repeated Point polygonVertices = 1;
    optional bool shouldSkipConfirmation = 4;
    optional EmbeddedContent embeddedContent = 5;
    optional StatusLinkType statusLinkType = 8;
    oneof action {
        Location location = 2;
        ContextInfo.ForwardedNewsletterMessageInfo newsletter = 3;
        bool embeddedAction = 6;
        TapLinkAction tapAction = 7;
    }
    enum StatusLinkType {
        RASTERIZED_LINK_PREVIEW = 1;
        RASTERIZED_LINK_TRUNCATED = 2;
        RASTERIZED_LINK_FULL_URL = 3;
    }
}

message TapLinkAction {
    optional string title = 1;
    optional string tapUrl = 2;
}

message EmbeddedContent {
    oneof content {
        EmbeddedMessage embeddedMessage = 1;
        EmbeddedMusic embeddedMusic = 2;
    }
}

message EmbeddedMusic {
    optional string musicContentMediaId = 1;
    optional string songId = 2;
    optional string author = 3;
    optional string title = 4;
    optional string artworkDirectPath = 5;
    optional bytes artworkSha256 = 6;
    optional bytes artworkEncSha256 = 7;
    optional bytes artworkMediaKey = 11;
    optional string artistAttribution = 8;
    optional bytes countryBlocklist = 9;
    optional bool isExplicit = 10;
}

message EmbeddedMessage {
    optional string stanzaId = 1;
    optional Message message = 2;
}

message DeviceListMetadata {
    optional bytes senderKeyHash = 1;
    optional uint64 senderTimestamp = 2;
    repeated uint32 senderKeyIndexes = 3 [packed=true];
    optional Adv.ADVEncryptionType senderAccountType = 4;
    optional Adv.ADVEncryptionType receiverAccountType = 5;
    optional bytes recipientKeyHash = 8;
    optional uint64 recipientTimestamp = 9;
    repeated uint32 recipientKeyIndexes = 10 [packed=true];
}

message MessageContextInfo {
    optional DeviceListMetadata deviceListMetadata = 1;
    optional int32 deviceListMetadataVersion = 2;
    optional bytes messageSecret = 3;
    optional bytes paddingBytes = 4;
    optional uint32 messageAddOnDurationInSecs = 5;
    optional bytes botMessageSecret = 6;
    optional AICommon.BotMetadata botMetadata = 7;
    optional int32 reportingTokenVersion = 8;
    optional MessageAddonExpiryType messageAddOnExpiryType = 9;
    optional MessageAssociation messageAssociation = 10;
    optional bool capiCreatedGroup = 11;
    optional string supportPayload = 12;
    optional Protocol.LimitSharing limitSharing = 13;
    optional Protocol.LimitSharing limitSharingV2 = 14;
    repeated ThreadID threadId = 15;
    enum MessageAddonExpiryType {
        STATIC = 1;
        DEPENDENT_ON_PARENT = 2;
    }
}

message ThreadID {
    optional ThreadType threadType = 1;
    optional Protocol.MessageKey threadKey = 2;
    enum ThreadType {
        UNKNOWN = 0;
        VIEW_REPLIES = 1;
        AI_THREAD = 2;
    }
}

message MessageAssociation {
    optional AssociationType associationType = 1;
    optional Protocol.MessageKey parentMessageKey = 2;
    optional int32 messageIndex = 3;
    enum AssociationType {
        UNKNOWN = 0;
        MEDIA_ALBUM = 1;
        BOT_PLUGIN = 2;
        EVENT_COVER_IMAGE = 3;
        STATUS_POLL = 4;
        HD_VIDEO_DUAL_UPLOAD = 5;
        STATUS_EXTERNAL_RESHARE = 6;
        MEDIA_POLL = 7;
        STATUS_ADD_YOURS = 8;
        STATUS_NOTIFICATION = 9;
        HD_IMAGE_DUAL_UPLOAD = 10;
        STICKER_ANNOTATION = 11;
        MOTION_PHOTO = 12;
        STATUS_LINK_ACTION = 13;
        VIEW_ALL_REPLIES = 14;
        STATUS_ADD_YOURS_AI_IMAGINE = 15;
        STATUS_QUESTION = 16;
        STATUS_ADD_YOURS_DIWALI = 17;
    }
}

message ContextInfo {
    optional string stanzaId = 1;
    optional string participant = 2;
    optional Message quotedMessage = 3;
    optional string remoteJid = 4;
    repeated string mentionedJid = 15;
    optional string conversionSource = 18;
    optional bytes conversionData = 19;
    optional uint32 conversionDelaySeconds = 20;
    optional uint32 forwardingScore = 21;
    optional bool isForwarded = 22;
    optional AdReplyInfo quotedAd = 23;
    optional Protocol.MessageKey placeholderKey = 24;
    optional uint32 expiration = 25;
    optional int64 ephemeralSettingTimestamp = 26;
    optional bytes ephemeralSharedSecret = 27;
    optional ExternalAdReplyInfo externalAdReply = 28;
    optional string entryPointConversionSource = 29;
    optional string entryPointConversionApp = 30;
    optional uint32 entryPointConversionDelaySeconds = 31;
    optional DisappearingMode disappearingMode = 32;
    optional ActionLink actionLink = 33;
    optional string groupSubject = 34;
    optional string parentGroupJid = 35;
    optional string trustBannerType = 37;
    optional uint32 trustBannerAction = 38;
    optional bool isSampled = 39;
    repeated GroupMention groupMentions = 40;
    optional UTMInfo utm = 41;
    optional ForwardedNewsletterMessageInfo forwardedNewsletterMessageInfo = 43;
    optional BusinessMessageForwardInfo businessMessageForwardInfo = 44;
    optional string smbClientCampaignId = 45;
    optional string smbServerCampaignId = 46;
    optional DataSharingContext dataSharingContext = 47;
    optional bool alwaysShowAdAttribution = 48;
    optional FeatureEligibilities featureEligibilities = 49;
    optional string entryPointConversionExternalSource = 50;
    optional string entryPointConversionExternalMedium = 51;
    optional string ctwaSignals = 54;
    optional bytes ctwaPayload = 55;
    optional AICommon.ForwardedAIBotMessageInfo forwardedAiBotMessageInfo = 56;
    optional StatusAttributionType statusAttributionType = 57;
    optional UrlTrackingMap urlTrackingMap = 58;
    optional PairedMediaType pairedMediaType = 59;
    optional uint32 rankingVersion = 60;
    optional MemberLabel memberLabel = 62;
    optional bool isQuestion = 63;
    optional StatusSourceType statusSourceType = 64;
    repeated StatusAttributions.StatusAttribution statusAttributions = 65;
    optional bool isGroupStatus = 66;
    optional ForwardOrigin forwardOrigin = 67;
    optional QuestionReplyQuotedMessage questionReplyQuotedMessage = 68;
    optional StatusAudienceMetadata statusAudienceMetadata = 69;
    optional uint32 nonJidMentions = 70;
    optional QuotedType quotedType = 71;
    message AdReplyInfo {
        optional string advertiserName = 1;
        optional MediaType mediaType = 2;
        optional bytes jpegThumbnail = 16;
        optional string caption = 17;
        enum MediaType {
            NONE = 0;
            IMAGE = 1;
            VIDEO = 2;
        }
    }
    message BusinessMessageForwardInfo {
        optional string businessOwnerJid = 1;
    }
    message DataSharingContext {
        optional bool showMmDisclosure = 1;
        optional string encryptedSignalTokenConsented = 2;
        repeated Parameters parameters = 3;
        optional int32 dataSharingFlags = 4;
        enum DataSharingFlags {
            SHOW_MM_DISCLOSURE_ON_CLICK = 1;
            SHOW_MM_DISCLOSURE_ON_READ = 2;
        }
        message Parameters {
            optional string key = 1;
            optional string stringData = 2;
            optional int64 intData = 3;
            optional float floatData = 4;
            optional ContextInfo.DataSharingContext.Parameters contents = 5;
        }
    }
    message ExternalAdReplyInfo {
        optional string title = 1;
        optional string body = 2;
        optional MediaType mediaType = 3;
        optional string thumbnailUrl = 4;
        optional string mediaUrl = 5;
        optional bytes thumbnail = 6;
        optional string sourceType = 7;
        optional string sourceId = 8;
        optional string sourceUrl = 9;
        optional bool containsAutoReply = 10;
        optional bool renderLargerThumbnail = 11;
        optional bool showAdAttribution = 12;
        optional string ctwaClid = 13;
        optional string ref = 14;
        optional bool clickToWhatsappCall = 15;
        optional bool adContextPreviewDismissed = 16;
        optional string sourceApp = 17;
        optional bool automatedGreetingMessageShown = 18;
        optional string greetingMessageBody = 19;
        optional string ctaPayload = 20;
        optional bool disableNudge = 21;
        optional string originalImageUrl = 22;
        optional string automatedGreetingMessageCtaType = 23;
        optional bool wtwaAdFormat = 24;
        optional AdType adType = 25;
        optional string wtwaWebsiteUrl = 26;
        optional string adPreviewUrl = 27;
        enum AdType {
            CTWA = 0;
            CAWC = 1;
        }
        enum MediaType {
            NONE = 0;
            IMAGE = 1;
            VIDEO = 2;
        }
    }
    message FeatureEligibilities {
        optional bool cannotBeReactedTo = 1;
        optional bool cannotBeRanked = 2;
        optional bool canRequestFeedback = 3;
        optional bool canBeReshared = 4;
        optional bool canReceiveMultiReact = 5;
    }
    enum ForwardOrigin {
        UNKNOWN = 0;
        CHAT = 1;
        STATUS = 2;
        CHANNELS = 3;
        META_AI = 4;
        UGC = 5;
    }
    message ForwardedNewsletterMessageInfo {
        optional string newsletterJid = 1;
        optional int32 serverMessageId = 2;
        optional string newsletterName = 3;
        optional ContentType contentType = 4;
        optional string accessibilityText = 5;
        enum ContentType {
            UPDATE = 1;
            UPDATE_CARD = 2;
            LINK_CARD = 3;
        }
    }
    enum PairedMediaType {
        NOT_PAIRED_MEDIA = 0;
        SD_VIDEO_PARENT = 1;
        HD_VIDEO_CHILD = 2;
        SD_IMAGE_PARENT = 3;
        HD_IMAGE_CHILD = 4;
        MOTION_PHOTO_PARENT = 5;
        MOTION_PHOTO_CHILD = 6;
    }
    message QuestionReplyQuotedMessage {
        optional int32 serverQuestionId = 1;
        optional Message quotedQuestion = 2;
        optional Message quotedResponse = 3;
    }
    enum QuotedType {
        EXPLICIT = 0;
        AUTO = 1;
    }
    enum StatusAttributionType {
        NONE = 0;
        RESHARED_FROM_MENTION = 1;
        RESHARED_FROM_POST = 2;
        RESHARED_FROM_POST_MANY_TIMES = 3;
        FORWARDED_FROM_STATUS = 4;
    }
    message StatusAudienceMetadata {
        optional AudienceType audienceType = 1;
        enum AudienceType {
            UNKNOWN = 0;
            CLOSE_FRIENDS = 1;
        }
    }
    enum StatusSourceType {
        IMAGE = 0;
        VIDEO = 1;
        GIF = 2;
        AUDIO = 3;
        TEXT = 4;
        MUSIC_STANDALONE = 5;
    }
    message UTMInfo {
        optional string utmSource = 1;
        optional string utmCampaign = 2;
    }
}

message Message {
    optional string conversation = 1;
    optional SenderKeyDistributionMessage senderKeyDistributionMessage = 2;
    optional ImageMessage imageMessage = 3;
    optional ContactMessage contactMessage = 4;
    optional LocationMessage locationMessage = 5;
    optional ExtendedTextMessage extendedTextMessage = 6;
    optional DocumentMessage documentMessage = 7;
    optional AudioMessage audioMessage = 8;
    optional VideoMessage videoMessage = 9;
    optional Call call = 10;
    optional Chat chat = 11;
    optional ProtocolMessage protocolMessage = 12;
    optional ContactsArrayMessage contactsArrayMessage = 13;
    optional HighlyStructuredMessage highlyStructuredMessage = 14;
    optional SenderKeyDistributionMessage fastRatchetKeySenderKeyDistributionMessage = 15;
    optional SendPaymentMessage sendPaymentMessage = 16;
    optional LiveLocationMessage liveLocationMessage = 18;
    optional RequestPaymentMessage requestPaymentMessage = 22;
    optional DeclinePaymentRequestMessage declinePaymentRequestMessage = 23;
    optional CancelPaymentRequestMessage cancelPaymentRequestMessage = 24;
    optional TemplateMessage templateMessage = 25;
    optional StickerMessage stickerMessage = 26;
    optional GroupInviteMessage groupInviteMessage = 28;
    optional TemplateButtonReplyMessage templateButtonReplyMessage = 29;
    optional ProductMessage productMessage = 30;
    optional DeviceSentMessage deviceSentMessage = 31;
    optional MessageContextInfo messageContextInfo = 35;
    optional ListMessage listMessage = 36;
    optional FutureProofMessage viewOnceMessage = 37;
    optional OrderMessage orderMessage = 38;
    optional ListResponseMessage listResponseMessage = 39;
    optional FutureProofMessage ephemeralMessage = 40;
    optional InvoiceMessage invoiceMessage = 41;
    optional ButtonsMessage buttonsMessage = 42;
    optional ButtonsResponseMessage buttonsResponseMessage = 43;
    optional PaymentInviteMessage paymentInviteMessage = 44;
    optional InteractiveMessage interactiveMessage = 45;
    optional ReactionMessage reactionMessage = 46;
    optional StickerSyncRMRMessage stickerSyncRmrMessage = 47;
    optional InteractiveResponseMessage interactiveResponseMessage = 48;
    optional PollCreationMessage pollCreationMessage = 49;
    optional PollUpdateMessage pollUpdateMessage = 50;
    optional KeepInChatMessage keepInChatMessage = 51;
    optional FutureProofMessage documentWithCaptionMessage = 53;
    optional RequestPhoneNumberMessage requestPhoneNumberMessage = 54;
    optional FutureProofMessage viewOnceMessageV2 = 55;
    optional EncReactionMessage encReactionMessage = 56;
    optional FutureProofMessage editedMessage = 58;
    optional FutureProofMessage viewOnceMessageV2Extension = 59;
    optional PollCreationMessage pollCreationMessageV2 = 60;
    optional ScheduledCallCreationMessage scheduledCallCreationMessage = 61;
    optional FutureProofMessage groupMentionedMessage = 62;
    optional PinInChatMessage pinInChatMessage = 63;
    optional PollCreationMessage pollCreationMessageV3 = 64;
    optional ScheduledCallEditMessage scheduledCallEditMessage = 65;
    optional VideoMessage ptvMessage = 66;
    optional FutureProofMessage botInvokeMessage = 67;
    optional CallLogMessage callLogMesssage = 69;
    optional MessageHistoryBundle messageHistoryBundle = 70;
    optional EncCommentMessage encCommentMessage = 71;
    optional BCallMessage bcallMessage = 72;
    optional FutureProofMessage lottieStickerMessage = 74;
    optional EventMessage eventMessage = 75;
    optional EncEventResponseMessage encEventResponseMessage = 76;
    optional CommentMessage commentMessage = 77;
    optional NewsletterAdminInviteMessage newsletterAdminInviteMessage = 78;
    optional PlaceholderMessage placeholderMessage = 80;
    optional SecretEncryptedMessage secretEncryptedMessage = 82;
    optional AlbumMessage albumMessage = 83;
    optional FutureProofMessage eventCoverImage = 85;
    optional StickerPackMessage stickerPackMessage = 86;
    optional FutureProofMessage statusMentionMessage = 87;
    optional PollResultSnapshotMessage pollResultSnapshotMessage = 88;
    optional FutureProofMessage pollCreationOptionImageMessage = 90;
    optional FutureProofMessage associatedChildMessage = 91;
    optional FutureProofMessage groupStatusMentionMessage = 92;
    optional FutureProofMessage pollCreationMessageV4 = 93;
    optional FutureProofMessage pollCreationMessageV5 = 94;
    optional FutureProofMessage statusAddYours = 95;
    optional FutureProofMessage groupStatusMessage = 96;
    optional AIRichResponseMessage richResponseMessage = 97;
    optional StatusNotificationMessage statusNotificationMessage = 98;
    optional FutureProofMessage limitSharingMessage = 99;
    optional FutureProofMessage botTaskMessage = 100;
    optional FutureProofMessage questionMessage = 101;
    optional MessageHistoryNotice messageHistoryNotice = 102;
    optional FutureProofMessage groupStatusMessageV2 = 103;
    optional FutureProofMessage botForwardedMessage = 104;
    optional StatusQuestionAnswerMessage statusQuestionAnswerMessage = 105;
    optional FutureProofMessage questionReplyMessage = 106;
    optional QuestionResponseMessage questionResponseMessage = 107;
    optional NewsletterFollowerInviteMessage newsletterFollowerInviteMessage = 108;
    optional StatusQuotedMessage statusQuotedMessage = 109;
    message AlbumMessage {
        optional uint32 expectedImageCount = 2;
        optional uint32 expectedVideoCount = 3;
        optional ContextInfo contextInfo = 17;
    }
    message AppStateFatalExceptionNotification {
        repeated string collectionNames = 1;
        optional int64 timestamp = 2;
    }
    message AppStateSyncKey {
        optional Message.AppStateSyncKeyId keyId = 1;
        optional Message.AppStateSyncKeyData keyData = 2;
    }
    message AppStateSyncKeyData {
        optional bytes keyData = 1;
        optional Message.AppStateSyncKeyFingerprint fingerprint = 2;
        optional int64 timestamp = 3;
    }
    message AppStateSyncKeyFingerprint {
        optional uint32 rawId = 1;
        optional uint32 currentIndex = 2;
        repeated uint32 deviceIndexes = 3 [packed=true];
    }
    message AppStateSyncKeyId {
        optional bytes keyId = 1;
    }
    message AppStateSyncKeyRequest {
        repeated Message.AppStateSyncKeyId keyIds = 1;
    }
    message AppStateSyncKeyShare {
        repeated Message.AppStateSyncKey keys = 1;
    }
    message AudioMessage {
        optional string url = 1;
        optional string mimetype = 2;
        optional bytes fileSha256 = 3;
        optional uint64 fileLength = 4;
        optional uint32 seconds = 5;
        optional bool ptt = 6;
        optional bytes mediaKey = 7;
        optional bytes fileEncSha256 = 8;
        optional string directPath = 9;
        optional int64 mediaKeyTimestamp = 10;
        optional ContextInfo contextInfo = 17;
        optional bytes streamingSidecar = 18;
        optional bytes waveform = 19;
        optional fixed32 backgroundArgb = 20;
        optional bool viewOnce = 21;
        optional string accessibilityLabel = 22;
        optional Message.MediaKeyDomain mediaKeyDomain = 23;
    }
    message BCallMessage {
        optional string sessionId = 1;
        optional MediaType mediaType = 2;
        optional bytes masterKey = 3;
        optional string caption = 4;
        enum MediaType {
            UNKNOWN = 0;
            AUDIO = 1;
            VIDEO = 2;
        }
    }
    message ButtonsMessage {
        optional string contentText = 6;
        optional string footerText = 7;
        optional ContextInfo contextInfo = 8;
        repeated Button buttons = 9;
        optional HeaderType headerType = 10;
        oneof header {
            string text = 1;
            Message.DocumentMessage documentMessage = 2;
            Message.ImageMessage imageMessage = 3;
            Message.VideoMessage videoMessage = 4;
            Message.LocationMessage locationMessage = 5;
        }
        message Button {
            optional string buttonId = 1;
            optional ButtonText buttonText = 2;
            optional Type type = 3;
            optional NativeFlowInfo nativeFlowInfo = 4;
            message ButtonText {
                optional string displayText = 1;
            }
            message NativeFlowInfo {
                optional string name = 1;
                optional string paramsJson = 2;
            }
            enum Type {
                UNKNOWN = 0;
                RESPONSE = 1;
                NATIVE_FLOW = 2;
            }
        }
        enum HeaderType {
            UNKNOWN = 0;
            EMPTY = 1;
            TEXT = 2;
            DOCUMENT = 3;
            IMAGE = 4;
            VIDEO = 5;
            LOCATION = 6;
        }
    }
    message ButtonsResponseMessage {
        optional string selectedButtonId = 1;
        optional ContextInfo contextInfo = 3;
        optional Type type = 4;
        oneof response {
            string selectedDisplayText = 2;
        }
        enum Type {
            UNKNOWN = 0;
            DISPLAY_TEXT = 1;
        }
    }
    message Call {
        optional bytes callKey = 1;
        optional string conversionSource = 2;
        optional bytes conversionData = 3;
        optional uint32 conversionDelaySeconds = 4;
        optional string ctwaSignals = 5;
        optional bytes ctwaPayload = 6;
        optional ContextInfo contextInfo = 7;
        optional string nativeFlowCallButtonPayload = 8;
        optional string deeplinkPayload = 9;
    }
    message CallLogMessage {
        optional bool isVideo = 1;
        optional CallOutcome callOutcome = 2;
        optional int64 durationSecs = 3;
        optional CallType callType = 4;
        repeated CallParticipant participants = 5;
        enum CallOutcome {
            CONNECTED = 0;
            MISSED = 1;
            FAILED = 2;
            REJECTED = 3;
            ACCEPTED_ELSEWHERE = 4;
            ONGOING = 5;
            SILENCED_BY_DND = 6;
            SILENCED_UNKNOWN_CALLER = 7;
        }
        message CallParticipant {
            optional string jid = 1;
            optional Message.CallLogMessage.CallOutcome callOutcome = 2;
        }
        enum CallType {
            REGULAR = 0;
            SCHEDULED_CALL = 1;
            VOICE_CHAT = 2;
        }
    }
    message CancelPaymentRequestMessage {
        optional Protocol.MessageKey key = 1;
    }
    message Chat {
        optional string displayName = 1;
        optional string id = 2;
    }
    message CloudAPIThreadControlNotification {
        optional CloudAPIThreadControl status = 1;
        optional int64 senderNotificationTimestampMs = 2;
        optional string consumerLid = 3;
        optional string consumerPhoneNumber = 4;
        optional CloudAPIThreadControlNotificationContent notificationContent = 5;
        optional bool shouldSuppressNotification = 6;
        enum CloudAPIThreadControl {
            UNKNOWN = 0;
            CONTROL_PASSED = 1;
            CONTROL_TAKEN = 2;
        }
        message CloudAPIThreadControlNotificationContent {
            optional string handoffNotificationText = 1;
            optional string extraJson = 2;
        }
    }
    message CommentMessage {
        optional Message message = 1;
        optional Protocol.MessageKey targetMessageKey = 2;
    }
    message ContactMessage {
        optional string displayName = 1;
        optional string vcard = 16;
        optional ContextInfo contextInfo = 17;
    }
    message ContactsArrayMessage {
        optional string displayName = 1;
        repeated Message.ContactMessage contacts = 2;
        optional ContextInfo contextInfo = 17;
    }
    message DeclinePaymentRequestMessage {
        optional Protocol.MessageKey key = 1;
    }
    message DeviceSentMessage {
        optional string destinationJid = 1;
        optional Message message = 2;
        optional string phash = 3;
    }
    message DocumentMessage {
        optional string url = 1;
        optional string mimetype = 2;
        optional string title = 3;
        optional bytes fileSha256 = 4;
        optional uint64 fileLength = 5;
        optional uint32 pageCount = 6;
        optional bytes mediaKey = 7;
        optional string fileName = 8;
        optional bytes fileEncSha256 = 9;
        optional string directPath = 10;
        optional int64 mediaKeyTimestamp = 11;
        optional bool contactVcard = 12;
        optional string thumbnailDirectPath = 13;
        optional bytes thumbnailSha256 = 14;
        optional bytes thumbnailEncSha256 = 15;
        optional bytes jpegThumbnail = 16;
        optional ContextInfo contextInfo = 17;
        optional uint32 thumbnailHeight = 18;
        optional uint32 thumbnailWidth = 19;
        optional string caption = 20;
        optional string accessibilityLabel = 21;
        optional Message.MediaKeyDomain mediaKeyDomain = 22;
    }
    message EncCommentMessage {
        optional Protocol.MessageKey targetMessageKey = 1;
        optional bytes encPayload = 2;
        optional bytes encIv = 3;
    }
    message EncEventResponseMessage {
        optional Protocol.MessageKey eventCreationMessageKey = 1;
        optional bytes encPayload = 2;
        optional bytes encIv = 3;
    }
    message EncReactionMessage {
        optional Protocol.MessageKey targetMessageKey = 1;
        optional bytes encPayload = 2;
        optional bytes encIv = 3;
    }
    message EventMessage {
        optional ContextInfo contextInfo = 1;
        optional bool isCanceled = 2;
        optional string name = 3;
        optional string description = 4;
        optional Message.LocationMessage location = 5;
        optional string joinLink = 6;
        optional int64 startTime = 7;
        optional int64 endTime = 8;
        optional bool extraGuestsAllowed = 9;
        optional bool isScheduleCall = 10;
    }
    message EventResponseMessage {
        optional EventResponseType response = 1;
        optional int64 timestampMs = 2;
        optional int32 extraGuestCount = 3;
        enum EventResponseType {
            UNKNOWN = 0;
            GOING = 1;
            NOT_GOING = 2;
            MAYBE = 3;
        }
    }
    message ExtendedTextMessage {
        optional string text = 1;
        optional string matchedText = 2;
        optional string description = 5;
        optional string title = 6;
        optional fixed32 textArgb = 7;
        optional fixed32 backgroundArgb = 8;
        optional FontType font = 9;
        optional PreviewType previewType = 10;
        optional bytes jpegThumbnail = 16;
        optional ContextInfo contextInfo = 17;
        optional bool doNotPlayInline = 18;
        optional string thumbnailDirectPath = 19;
        optional bytes thumbnailSha256 = 20;
        optional bytes thumbnailEncSha256 = 21;
        optional bytes mediaKey = 22;
        optional int64 mediaKeyTimestamp = 23;
        optional uint32 thumbnailHeight = 24;
        optional uint32 thumbnailWidth = 25;
        optional InviteLinkGroupType inviteLinkGroupType = 26;
        optional string inviteLinkParentGroupSubjectV2 = 27;
        optional bytes inviteLinkParentGroupThumbnailV2 = 28;
        optional InviteLinkGroupType inviteLinkGroupTypeV2 = 29;
        optional bool viewOnce = 30;
        optional uint32 videoHeight = 31;
        optional uint32 videoWidth = 32;
        optional Message.MMSThumbnailMetadata faviconMMSMetadata = 33;
        optional Message.LinkPreviewMetadata linkPreviewMetadata = 34;
        optional Message.PaymentLinkMetadata paymentLinkMetadata = 35;
        repeated Message.VideoEndCard endCardTiles = 36;
        optional string videoContentUrl = 37;
        optional EmbeddedMusic musicMetadata = 38;
        enum FontType {
            SYSTEM = 0;
            SYSTEM_TEXT = 1;
            FB_SCRIPT = 2;
            SYSTEM_BOLD = 6;
            MORNINGBREEZE_REGULAR = 7;
            CALISTOGA_REGULAR = 8;
            EXO2_EXTRABOLD = 9;
            COURIERPRIME_BOLD = 10;
        }
        enum InviteLinkGroupType {
            DEFAULT = 0;
            PARENT = 1;
            SUB = 2;
            DEFAULT_SUB = 3;
        }
        enum PreviewType {
            NONE = 0;
            VIDEO = 1;
            PLACEHOLDER = 4;
            IMAGE = 5;
            PAYMENT_LINKS = 6;
            PROFILE = 7;
        }
    }
    message FullHistorySyncOnDemandRequestMetadata {
        optional string requestId = 1;
    }
    message FutureProofMessage {
        optional Message message = 1;
    }
    message GroupInviteMessage {
        optional string groupJid = 1;
        optional string inviteCode = 2;
        optional int64 inviteExpiration = 3;
        optional string groupName = 4;
        optional bytes jpegThumbnail = 5;
        optional string caption = 6;
        optional ContextInfo contextInfo = 7;
        optional GroupType groupType = 8;
        enum GroupType {
            DEFAULT = 0;
            PARENT = 1;
        }
    }
    message HighlyStructuredMessage {
        optional string namespace = 1;
        optional string elementName = 2;
        repeated string params = 3;
        optional string fallbackLg = 4;
        optional string fallbackLc = 5;
        repeated HSMLocalizableParameter localizableParams = 6;
        optional string deterministicLg = 7;
        optional string deterministicLc = 8;
        optional Message.TemplateMessage hydratedHsm = 9;
        message HSMLocalizableParameter {
            optional string default = 1;
            oneof paramOneof {
                Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency currency = 2;
                Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime dateTime = 3;
            }
            message HSMCurrency {
                optional string currencyCode = 1;
                optional int64 amount1000 = 2;
            }
            message HSMDateTime {
                oneof datetimeOneof {
                    Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent component = 1;
                    Message.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch unixEpoch = 2;
                }
                message HSMDateTimeComponent {
                    optional DayOfWeekType dayOfWeek = 1;
                    optional uint32 year = 2;
                    optional uint32 month = 3;
                    optional uint32 dayOfMonth = 4;
                    optional uint32 hour = 5;
                    optional uint32 minute = 6;
                    optional CalendarType calendar = 7;
                    enum CalendarType {
                        GREGORIAN = 1;
                        SOLAR_HIJRI = 2;
                    }
                    enum DayOfWeekType {
                        MONDAY = 1;
                        TUESDAY = 2;
                        WEDNESDAY = 3;
                        THURSDAY = 4;
                        FRIDAY = 5;
                        SATURDAY = 6;
                        SUNDAY = 7;
                    }
                }
                message HSMDateTimeUnixEpoch {
                    optional int64 timestamp = 1;
                }
            }
        }
    }
    message HistorySyncNotification {
        optional bytes fileSha256 = 1;
        optional uint64 fileLength = 2;
        optional bytes mediaKey = 3;
        optional bytes fileEncSha256 = 4;
        optional string directPath = 5;
        optional Message.HistorySyncType syncType = 6;
        optional uint32 chunkOrder = 7;
        optional string originalMessageId = 8;
        optional uint32 progress = 9;
        optional int64 oldestMsgInChunkTimestampSec = 10;
        optional bytes initialHistBootstrapInlinePayload = 11;
        optional string peerDataRequestSessionId = 12;
        optional Message.FullHistorySyncOnDemandRequestMetadata fullHistorySyncOnDemandRequestMetadata = 13;
        optional string encHandle = 14;
    }
    enum HistorySyncType {
        INITIAL_BOOTSTRAP = 0;
        INITIAL_STATUS_V3 = 1;
        FULL = 2;
        RECENT = 3;
        PUSH_NAME = 4;
        NON_BLOCKING_DATA = 5;
        ON_DEMAND = 6;
        NO_HISTORY = 7;
    }
    message ImageMessage {
        optional string url = 1;
        optional string mimetype = 2;
        optional string caption = 3;
        optional bytes fileSha256 = 4;
        optional uint64 fileLength = 5;
        optional uint32 height = 6;
        optional uint32 width = 7;
        optional bytes mediaKey = 8;
        optional bytes fileEncSha256 = 9;
        repeated InteractiveAnnotation interactiveAnnotations = 10;
        optional string directPath = 11;
        optional int64 mediaKeyTimestamp = 12;
        optional bytes jpegThumbnail = 16;
        optional ContextInfo contextInfo = 17;
        optional bytes firstScanSidecar = 18;
        optional uint32 firstScanLength = 19;
        optional uint32 experimentGroupId = 20;
        optional bytes scansSidecar = 21;
        repeated uint32 scanLengths = 22;
        optional bytes midQualityFileSha256 = 23;
        optional bytes midQualityFileEncSha256 = 24;
        optional bool viewOnce = 25;
        optional string thumbnailDirectPath = 26;
        optional bytes thumbnailSha256 = 27;
        optional bytes thumbnailEncSha256 = 28;
        optional string staticUrl = 29;
        repeated InteractiveAnnotation annotations = 30;
        optional ImageSourceType imageSourceType = 31;
        optional string accessibilityLabel = 32;
        optional Message.MediaKeyDomain mediaKeyDomain = 33;
        optional string qrUrl = 34;
        enum ImageSourceType {
            USER_IMAGE = 0;
            AI_GENERATED = 1;
            AI_MODIFIED = 2;
            RASTERIZED_TEXT_STATUS = 3;
        }
    }
    message InitialSecurityNotificationSettingSync {
        optional bool securityNotificationEnabled = 1;
    }
    message InteractiveMessage {
        optional Header header = 1;
        optional Body body = 2;
        optional Footer footer = 3;
        optional ContextInfo contextInfo = 15;
        optional UrlTrackingMap urlTrackingMap = 16;
        oneof interactiveMessage {
            Message.InteractiveMessage.ShopMessage shopStorefrontMessage = 4;
            Message.InteractiveMessage.CollectionMessage collectionMessage = 5;
            Message.InteractiveMessage.NativeFlowMessage nativeFlowMessage = 6;
            Message.InteractiveMessage.CarouselMessage carouselMessage = 7;
        }
        message Body {
            optional string text = 1;
        }
        message CarouselMessage {
            repeated Message.InteractiveMessage cards = 1;
            optional int32 messageVersion = 2;
            optional CarouselCardType carouselCardType = 3;
            enum CarouselCardType {
                UNKNOWN = 0;
                HSCROLL_CARDS = 1;
                ALBUM_IMAGE = 2;
            }
        }
        message CollectionMessage {
            optional string bizJid = 1;
            optional string id = 2;
            optional int32 messageVersion = 3;
        }
        message Footer {
            optional string text = 1;
        }
        message Header {
            optional string title = 1;
            optional string subtitle = 2;
            optional bool hasMediaAttachment = 5;
            oneof media {
                Message.DocumentMessage documentMessage = 3;
                Message.ImageMessage imageMessage = 4;
                bytes jpegThumbnail = 6;
                Message.VideoMessage videoMessage = 7;
                Message.LocationMessage locationMessage = 8;
                Message.ProductMessage productMessage = 9;
            }
        }
        message NativeFlowMessage {
            repeated NativeFlowButton buttons = 1;
            optional string messageParamsJson = 2;
            optional int32 messageVersion = 3;
            message NativeFlowButton {
                optional string name = 1;
                optional string buttonParamsJson = 2;
            }
        }
        message ShopMessage {
            optional string id = 1;
            optional Surface surface = 2;
            optional int32 messageVersion = 3;
            enum Surface {
                UNKNOWN_SURFACE = 0;
                FB = 1;
                IG = 2;
                WA = 3;
            }
        }
    }
    message InteractiveResponseMessage {
        optional Body body = 1;
        optional ContextInfo contextInfo = 15;
        oneof interactiveResponseMessage {
            Message.InteractiveResponseMessage.NativeFlowResponseMessage nativeFlowResponseMessage = 2;
        }
        message Body {
            optional string text = 1;
            optional Format format = 2;
            enum Format {
                DEFAULT = 0;
                EXTENSIONS_1 = 1;
            }
        }
        message NativeFlowResponseMessage {
            optional string name = 1;
            optional string paramsJson = 2;
            optional int32 version = 3;
        }
    }
    message InvoiceMessage {
        optional string note = 1;
        optional string token = 2;
        optional AttachmentType attachmentType = 3;
        optional string attachmentMimetype = 4;
        optional bytes attachmentMediaKey = 5;
        optional int64 attachmentMediaKeyTimestamp = 6;
        optional bytes attachmentFileSha256 = 7;
        optional bytes attachmentFileEncSha256 = 8;
        optional string attachmentDirectPath = 9;
        optional bytes attachmentJpegThumbnail = 10;
        enum AttachmentType {
            IMAGE = 0;
            PDF = 1;
        }
    }
    message KeepInChatMessage {
        optional Protocol.MessageKey key = 1;
        optional KeepType keepType = 2;
        optional int64 timestampMs = 3;
    }
    message LinkPreviewMetadata {
        optional Message.PaymentLinkMetadata paymentLinkMetadata = 1;
        optional Message.URLMetadata urlMetadata = 2;
        optional uint32 fbExperimentId = 3;
        optional uint32 linkMediaDuration = 4;
        optional SocialMediaPostType socialMediaPostType = 5;
        optional bool linkInlineVideoMuted = 6;
        enum SocialMediaPostType {
            NONE = 0;
            REEL = 1;
            LIVE_VIDEO = 2;
            LONG_VIDEO = 3;
            SINGLE_IMAGE = 4;
            CAROUSEL = 5;
        }
    }
    message ListMessage {
        optional string title = 1;
        optional string description = 2;
        optional string buttonText = 3;
        optional ListType listType = 4;
        repeated Section sections = 5;
        optional ProductListInfo productListInfo = 6;
        optional string footerText = 7;
        optional ContextInfo contextInfo = 8;
        enum ListType {
            UNKNOWN = 0;
            SINGLE_SELECT = 1;
            PRODUCT_LIST = 2;
        }
        message Product {
            optional string productId = 1;
        }
        message ProductListHeaderImage {
            optional string productId = 1;
            optional bytes jpegThumbnail = 2;
        }
        message ProductListInfo {
            repeated Message.ListMessage.ProductSection productSections = 1;
            optional Message.ListMessage.ProductListHeaderImage headerImage = 2;
            optional string businessOwnerJid = 3;
        }
        message ProductSection {
            optional string title = 1;
            repeated Message.ListMessage.Product products = 2;
        }
        message Row {
            optional string title = 1;
            optional string description = 2;
            optional string rowId = 3;
        }
        message Section {
            optional string title = 1;
            repeated Message.ListMessage.Row rows = 2;
        }
    }
    message ListResponseMessage {
        optional string title = 1;
        optional ListType listType = 2;
        optional SingleSelectReply singleSelectReply = 3;
        optional ContextInfo contextInfo = 4;
        optional string description = 5;
        enum ListType {
            UNKNOWN = 0;
            SINGLE_SELECT = 1;
        }
        message SingleSelectReply {
            optional string selectedRowId = 1;
        }
    }
    message LiveLocationMessage {
        optional double degreesLatitude = 1;
        optional double degreesLongitude = 2;
        optional uint32 accuracyInMeters = 3;
        optional float speedInMps = 4;
        optional uint32 degreesClockwiseFromMagneticNorth = 5;
        optional string caption = 6;
        optional int64 sequenceNumber = 7;
        optional uint32 timeOffset = 8;
        optional bytes jpegThumbnail = 16;
        optional ContextInfo contextInfo = 17;
    }
    message LocationMessage {
        optional double degreesLatitude = 1;
        optional double degreesLongitude = 2;
        optional string name = 3;
        optional string address = 4;
        optional string url = 5;
        optional bool isLive = 6;
        optional uint32 accuracyInMeters = 7;
        optional float speedInMps = 8;
        optional uint32 degreesClockwiseFromMagneticNorth = 9;
        optional string comment = 11;
        optional bytes jpegThumbnail = 16;
        optional ContextInfo contextInfo = 17;
    }
    message MMSThumbnailMetadata {
        optional string thumbnailDirectPath = 1;
        optional bytes thumbnailSha256 = 2;
        optional bytes thumbnailEncSha256 = 3;
        optional bytes mediaKey = 4;
        optional int64 mediaKeyTimestamp = 5;
        optional uint32 thumbnailHeight = 6;
        optional uint32 thumbnailWidth = 7;
        optional Message.MediaKeyDomain mediaKeyDomain = 8;
    }
    enum MediaKeyDomain {
        UNSET = 0;
        E2EE_CHAT = 1;
        STATUS = 2;
        CAPI = 3;
        BOT = 4;
    }
    message MessageHistoryBundle {
        optional string mimetype = 1;
        optional bytes fileSha256 = 2;
        optional bytes mediaKey = 3;
        optional bytes fileEncSha256 = 4;
        optional string directPath = 5;
        optional int64 mediaKeyTimestamp = 6;
        optional ContextInfo contextInfo = 7;
        optional Message.MessageHistoryMetadata messageHistoryMetadata = 8;
    }
    message MessageHistoryMetadata {
        repeated string historyReceivers = 1;
        optional int64 oldestMessageTimestamp = 2;
        optional int64 messageCount = 3;
    }
    message MessageHistoryNotice {
        optional ContextInfo contextInfo = 1;
        optional Message.MessageHistoryMetadata messageHistoryMetadata = 2;
    }
    message NewsletterAdminInviteMessage {
        optional string newsletterJid = 1;
        optional string newsletterName = 2;
        optional bytes jpegThumbnail = 3;
        optional string caption = 4;
        optional int64 inviteExpiration = 5;
        optional ContextInfo contextInfo = 6;
    }
    message NewsletterFollowerInviteMessage {
        optional string newsletterJid = 1;
        optional string newsletterName = 2;
        optional bytes jpegThumbnail = 3;
        optional string caption = 4;
        optional ContextInfo contextInfo = 5;
    }
    message OrderMessage {
        optional string orderId = 1;
        optional bytes thumbnail = 2;
        optional int32 itemCount = 3;
        optional OrderStatus status = 4;
        optional OrderSurface surface = 5;
        optional string message = 6;
        optional string orderTitle = 7;
        optional string sellerJid = 8;
        optional string token = 9;
        optional int64 totalAmount1000 = 10;
        optional string totalCurrencyCode = 11;
        optional ContextInfo contextInfo = 17;
        optional int32 messageVersion = 12;
        optional Protocol.MessageKey orderRequestMessageId = 13;
        optional string catalogType = 15;
        enum OrderStatus {
            INQUIRY = 1;
            ACCEPTED = 2;
            DECLINED = 3;
        }
        enum OrderSurface {
            CATALOG = 1;
        }
    }
    message PaymentInviteMessage {
        optional ServiceType serviceType = 1;
        optional int64 expiryTimestamp = 2;
        enum ServiceType {
            UNKNOWN = 0;
            FBPAY = 1;
            NOVI = 2;
            UPI = 3;
        }
    }
    message PaymentLinkMetadata {
        optional PaymentLinkButton button = 1;
        optional PaymentLinkHeader header = 2;
        optional PaymentLinkProvider provider = 3;
        message PaymentLinkButton {
            optional string displayText = 1;
        }
        message PaymentLinkHeader {
            optional PaymentLinkHeaderType headerType = 1;
            enum PaymentLinkHeaderType {
                LINK_PREVIEW = 0;
                ORDER = 1;
            }
        }
        message PaymentLinkProvider {
            optional string paramsJson = 1;
        }
    }
    message PeerDataOperationRequestMessage {
        optional Message.PeerDataOperationRequestType peerDataOperationRequestType = 1;
        repeated RequestStickerReupload requestStickerReupload = 2;
        repeated RequestUrlPreview requestUrlPreview = 3;
        optional HistorySyncOnDemandRequest historySyncOnDemandRequest = 4;
        repeated PlaceholderMessageResendRequest placeholderMessageResendRequest = 5;
        optional FullHistorySyncOnDemandRequest fullHistorySyncOnDemandRequest = 6;
        optional SyncDCollectionFatalRecoveryRequest syncdCollectionFatalRecoveryRequest = 7;
        optional HistorySyncChunkRetryRequest historySyncChunkRetryRequest = 8;
        message FullHistorySyncOnDemandRequest {
            optional Message.FullHistorySyncOnDemandRequestMetadata requestMetadata = 1;
            optional CompanionReg.DeviceProps.HistorySyncConfig historySyncConfig = 2;
        }
        message HistorySyncChunkRetryRequest {
            optional Message.HistorySyncType syncType = 1;
            optional uint32 chunkOrder = 2;
            optional string chunkNotificationId = 3;
            optional bool regenerateChunk = 4;
        }
        message HistorySyncOnDemandRequest {
            optional string chatJid = 1;
            optional string oldestMsgId = 2;
            optional bool oldestMsgFromMe = 3;
            optional int32 onDemandMsgCount = 4;
            optional int64 oldestMsgTimestampMs = 5;
            optional string accountLid = 6;
        }
        message PlaceholderMessageResendRequest {
            optional Protocol.MessageKey messageKey = 1;
        }
        message RequestStickerReupload {
            optional string fileSha256 = 1;
        }
        message RequestUrlPreview {
            optional string url = 1;
            optional bool includeHqThumbnail = 2;
        }
        message SyncDCollectionFatalRecoveryRequest {
            optional string collectionName = 1;
            optional int64 timestamp = 2;
        }
    }
    message PeerDataOperationRequestResponseMessage {
        optional Message.PeerDataOperationRequestType peerDataOperationRequestType = 1;
        optional string stanzaId = 2;
        repeated PeerDataOperationResult peerDataOperationResult = 3;
        message PeerDataOperationResult {
            optional MmsRetry.MediaRetryNotification.ResultType mediaUploadResult = 1;
            optional Message.StickerMessage stickerMessage = 2;
            optional LinkPreviewResponse linkPreviewResponse = 3;
            optional PlaceholderMessageResendResponse placeholderMessageResendResponse = 4;
            optional WaffleNonceFetchResponse waffleNonceFetchRequestResponse = 5;
            optional FullHistorySyncOnDemandRequestResponse fullHistorySyncOnDemandRequestResponse = 6;
            optional CompanionMetaNonceFetchResponse companionMetaNonceFetchRequestResponse = 7;
            optional SyncDSnapshotFatalRecoveryResponse syncdSnapshotFatalRecoveryResponse = 8;
            optional CompanionCanonicalUserNonceFetchResponse companionCanonicalUserNonceFetchRequestResponse = 9;
            optional HistorySyncChunkRetryResponse historySyncChunkRetryResponse = 10;
            message CompanionCanonicalUserNonceFetchResponse {
                optional string nonce = 1;
                optional string waFbid = 2;
                optional bool forceRefresh = 3;
            }
            message CompanionMetaNonceFetchResponse {
                optional string nonce = 1;
            }
            message FullHistorySyncOnDemandRequestResponse {
                optional Message.FullHistorySyncOnDemandRequestMetadata requestMetadata = 1;
                optional Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.FullHistorySyncOnDemandResponseCode responseCode = 2;
            }
            enum FullHistorySyncOnDemandResponseCode {
                REQUEST_SUCCESS = 0;
                REQUEST_TIME_EXPIRED = 1;
                DECLINED_SHARING_HISTORY = 2;
                GENERIC_ERROR = 3;
                ERROR_REQUEST_ON_NON_SMB_PRIMARY = 4;
                ERROR_HOSTED_DEVICE_NOT_CONNECTED = 5;
                ERROR_HOSTED_DEVICE_LOGIN_TIME_NOT_SET = 6;
            }
            message HistorySyncChunkRetryResponse {
                optional Message.HistorySyncType syncType = 1;
                optional uint32 chunkOrder = 2;
                optional string requestId = 3;
                optional Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.HistorySyncChunkRetryResponseCode responseCode = 4;
                optional bool canRecover = 5;
            }
            enum HistorySyncChunkRetryResponseCode {
                GENERATION_ERROR = 1;
                CHUNK_CONSUMED = 2;
                TIMEOUT = 3;
                SESSION_EXHAUSTED = 4;
                CHUNK_EXHAUSTED = 5;
                DUPLICATED_REQUEST = 6;
            }
            message LinkPreviewResponse {
                optional string url = 1;
                optional string title = 2;
                optional string description = 3;
                optional bytes thumbData = 4;
                optional string matchText = 6;
                optional string previewType = 7;
                optional LinkPreviewHighQualityThumbnail hqThumbnail = 8;
                optional PaymentLinkPreviewMetadata previewMetadata = 9;
                message LinkPreviewHighQualityThumbnail {
                    optional string directPath = 1;
                    optional string thumbHash = 2;
                    optional string encThumbHash = 3;
                    optional bytes mediaKey = 4;
                    optional int64 mediaKeyTimestampMs = 5;
                    optional int32 thumbWidth = 6;
                    optional int32 thumbHeight = 7;
                }
                message PaymentLinkPreviewMetadata {
                    optional bool isBusinessVerified = 1;
                    optional string providerName = 2;
                }
            }
            message PlaceholderMessageResendResponse {
                optional bytes webMessageInfoBytes = 1;
            }
            message SyncDSnapshotFatalRecoveryResponse {
                optional bytes collectionSnapshot = 1;
                optional bool isCompressed = 2;
            }
            message WaffleNonceFetchResponse {
                optional string nonce = 1;
                optional string waEntFbid = 2;
            }
        }
    }
    enum PeerDataOperationRequestType {
        UPLOAD_STICKER = 0;
        SEND_RECENT_STICKER_BOOTSTRAP = 1;
        GENERATE_LINK_PREVIEW = 2;
        HISTORY_SYNC_ON_DEMAND = 3;
        PLACEHOLDER_MESSAGE_RESEND = 4;
        WAFFLE_LINKING_NONCE_FETCH = 5;
        FULL_HISTORY_SYNC_ON_DEMAND = 6;
        COMPANION_META_NONCE_FETCH = 7;
        COMPANION_SYNCD_SNAPSHOT_FATAL_RECOVERY = 8;
        COMPANION_CANONICAL_USER_NONCE_FETCH = 9;
        HISTORY_SYNC_CHUNK_RETRY = 10;
    }
    message PinInChatMessage {
        optional Protocol.MessageKey key = 1;
        optional Type type = 2;
        optional int64 senderTimestampMs = 3;
        enum Type {
            UNKNOWN_TYPE = 0;
            PIN_FOR_ALL = 1;
            UNPIN_FOR_ALL = 2;
        }
    }
    message PlaceholderMessage {
        optional PlaceholderType type = 1;
        enum PlaceholderType {
            MASK_LINKED_DEVICES = 0;
        }
    }
    enum PollContentType {
        UNKNOWN = 0;
        TEXT = 1;
        IMAGE = 2;
    }
    message PollCreationMessage {
        optional bytes encKey = 1;
        optional string name = 2;
        repeated Option options = 3;
        optional uint32 selectableOptionsCount = 4;
        optional ContextInfo contextInfo = 5;
        optional Message.PollContentType pollContentType = 6;
        optional PollType pollType = 7;
        optional Option correctAnswer = 8;
        message Option {
            optional string optionName = 1;
            optional string optionHash = 2;
        }
        enum PollType {
            POLL = 0;
            QUIZ = 1;
        }
    }
    message PollEncValue {
        optional bytes encPayload = 1;
        optional bytes encIv = 2;
    }
    message PollResultSnapshotMessage {
        optional string name = 1;
        repeated PollVote pollVotes = 2;
        optional ContextInfo contextInfo = 3;
        message PollVote {
            optional string optionName = 1;
            optional int64 optionVoteCount = 2;
        }
    }
    message PollUpdateMessage {
        optional Protocol.MessageKey pollCreationMessageKey = 1;
        optional Message.PollEncValue vote = 2;
        optional Message.PollUpdateMessageMetadata metadata = 3;
        optional int64 senderTimestampMs = 4;
    }
    message PollUpdateMessageMetadata {
    }
    message PollVoteMessage {
        repeated bytes selectedOptions = 1;
    }
    message ProductMessage {
        optional ProductSnapshot product = 1;
        optional string businessOwnerJid = 2;
        optional CatalogSnapshot catalog = 4;
        optional string body = 5;
        optional string footer = 6;
        optional ContextInfo contextInfo = 17;
        message CatalogSnapshot {
            optional Message.ImageMessage catalogImage = 1;
            optional string title = 2;
            optional string description = 3;
        }
        message ProductSnapshot {
            optional Message.ImageMessage productImage = 1;
            optional string productId = 2;
            optional string title = 3;
            optional string description = 4;
            optional string currencyCode = 5;
            optional int64 priceAmount1000 = 6;
            optional string retailerId = 7;
            optional string url = 8;
            optional uint32 productImageCount = 9;
            optional string firstImageId = 11;
            optional int64 salePriceAmount1000 = 12;
            optional string signedUrl = 13;
        }
    }
    message ProtocolMessage {
        optional Protocol.MessageKey key = 1;
        optional Type type = 2;
        optional uint32 ephemeralExpiration = 4;
        optional int64 ephemeralSettingTimestamp = 5;
        optional Message.HistorySyncNotification historySyncNotification = 6;
        optional Message.AppStateSyncKeyShare appStateSyncKeyShare = 7;
        optional Message.AppStateSyncKeyRequest appStateSyncKeyRequest = 8;
        optional Message.InitialSecurityNotificationSettingSync initialSecurityNotificationSettingSync = 9;
        optional Message.AppStateFatalExceptionNotification appStateFatalExceptionNotification = 10;
        optional DisappearingMode disappearingMode = 11;
        optional Message editedMessage = 14;
        optional int64 timestampMs = 15;
        optional Message.PeerDataOperationRequestMessage peerDataOperationRequestMessage = 16;
        optional Message.PeerDataOperationRequestResponseMessage peerDataOperationRequestResponseMessage = 17;
        optional AICommon.BotFeedbackMessage botFeedbackMessage = 18;
        optional string invokerJid = 19;
        optional Message.RequestWelcomeMessageMetadata requestWelcomeMessageMetadata = 20;
        optional MediaNotifyMessage mediaNotifyMessage = 21;
        optional Message.CloudAPIThreadControlNotification cloudApiThreadControlNotification = 22;
        optional LIDMigrationMappingSyncMessage lidMigrationMappingSyncMessage = 23;
        optional Protocol.LimitSharing limitSharing = 24;
        optional bytes aiPsiMetadata = 25;
        optional AIQueryFanout aiQueryFanout = 26;
        optional MemberLabel memberLabel = 27;
        enum Type {
            REVOKE = 0;
            EPHEMERAL_SETTING = 3;
            EPHEMERAL_SYNC_RESPONSE = 4;
            HISTORY_SYNC_NOTIFICATION = 5;
            APP_STATE_SYNC_KEY_SHARE = 6;
            APP_STATE_SYNC_KEY_REQUEST = 7;
            MSG_FANOUT_BACKFILL_REQUEST = 8;
            INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC = 9;
            APP_STATE_FATAL_EXCEPTION_NOTIFICATION = 10;
            SHARE_PHONE_NUMBER = 11;
            MESSAGE_EDIT = 14;
            PEER_DATA_OPERATION_REQUEST_MESSAGE = 16;
            PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE = 17;
            REQUEST_WELCOME_MESSAGE = 18;
            BOT_FEEDBACK_MESSAGE = 19;
            MEDIA_NOTIFY_MESSAGE = 20;
            CLOUD_API_THREAD_CONTROL_NOTIFICATION = 21;
            LID_MIGRATION_MAPPING_SYNC = 22;
            REMINDER_MESSAGE = 23;
            BOT_MEMU_ONBOARDING_MESSAGE = 24;
            STATUS_MENTION_MESSAGE = 25;
            STOP_GENERATION_MESSAGE = 26;
            LIMIT_SHARING = 27;
            AI_PSI_METADATA = 28;
            AI_QUERY_FANOUT = 29;
            GROUP_MEMBER_LABEL_CHANGE = 30;
        }
    }
    message QuestionResponseMessage {
        optional Protocol.MessageKey key = 1;
        optional string text = 2;
    }
    message ReactionMessage {
        optional Protocol.MessageKey key = 1;
        optional string text = 2;
        optional string groupingKey = 3;
        optional int64 senderTimestampMs = 4;
    }
    message RequestPaymentMessage {
        optional Message noteMessage = 4;
        optional string currencyCodeIso4217 = 1;
        optional uint64 amount1000 = 2;
        optional string requestFrom = 3;
        optional int64 expiryTimestamp = 5;
        optional Money amount = 6;
        optional PaymentBackground background = 7;
    }
    message RequestPhoneNumberMessage {
        optional ContextInfo contextInfo = 1;
    }
    message RequestWelcomeMessageMetadata {
        optional LocalChatState localChatState = 1;
        enum LocalChatState {
            EMPTY = 0;
            NON_EMPTY = 1;
        }
    }
    message ScheduledCallCreationMessage {
        optional int64 scheduledTimestampMs = 1;
        optional CallType callType = 2;
        optional string title = 3;
        enum CallType {
            UNKNOWN = 0;
            VOICE = 1;
            VIDEO = 2;
        }
    }
    message ScheduledCallEditMessage {
        optional Protocol.MessageKey key = 1;
        optional EditType editType = 2;
        enum EditType {
            UNKNOWN = 0;
            CANCEL = 1;
        }
    }
    message SecretEncryptedMessage {
        optional Protocol.MessageKey targetMessageKey = 1;
        optional bytes encPayload = 2;
        optional bytes encIv = 3;
        optional SecretEncType secretEncType = 4;
        enum SecretEncType {
            UNKNOWN = 0;
            EVENT_EDIT = 1;
            MESSAGE_EDIT = 2;
        }
    }
    message SendPaymentMessage {
        optional Message noteMessage = 2;
        optional Protocol.MessageKey requestMessageKey = 3;
        optional PaymentBackground background = 4;
        optional string transactionData = 5;
    }
    message SenderKeyDistributionMessage {
        optional string groupId = 1;
        optional bytes axolotlSenderKeyDistributionMessage = 2;
    }
    message StatusNotificationMessage {
        optional Protocol.MessageKey responseMessageKey = 1;
        optional Protocol.MessageKey originalMessageKey = 2;
        optional StatusNotificationType type = 3;
        enum StatusNotificationType {
            UNKNOWN = 0;
            STATUS_ADD_YOURS = 1;
            STATUS_RESHARE = 2;
            STATUS_QUESTION_ANSWER_RESHARE = 3;
        }
    }
    message StatusQuestionAnswerMessage {
        optional Protocol.MessageKey key = 1;
        optional string text = 2;
    }
    message StatusQuotedMessage {
        optional StatusQuotedMessageType type = 1;
        optional string text = 2;
        optional bytes thumbnail = 3;
        optional Protocol.MessageKey originalStatusId = 4;
        enum StatusQuotedMessageType {
            QUESTION_ANSWER = 1;
        }
    }
    message StickerMessage {
        optional string url = 1;
        optional bytes fileSha256 = 2;
        optional bytes fileEncSha256 = 3;
        optional bytes mediaKey = 4;
        optional string mimetype = 5;
        optional uint32 height = 6;
        optional uint32 width = 7;
        optional string directPath = 8;
        optional uint64 fileLength = 9;
        optional int64 mediaKeyTimestamp = 10;
        optional uint32 firstFrameLength = 11;
        optional bytes firstFrameSidecar = 12;
        optional bool isAnimated = 13;
        optional bytes pngThumbnail = 16;
        optional ContextInfo contextInfo = 17;
        optional int64 stickerSentTs = 18;
        optional bool isAvatar = 19;
        optional bool isAiSticker = 20;
        optional bool isLottie = 21;
        optional string accessibilityLabel = 22;
        optional Message.MediaKeyDomain mediaKeyDomain = 23;
    }
    message StickerPackMessage {
        optional string stickerPackId = 1;
        optional string name = 2;
        optional string publisher = 3;
        repeated Sticker stickers = 4;
        optional uint64 fileLength = 5;
        optional bytes fileSha256 = 6;
        optional bytes fileEncSha256 = 7;
        optional bytes mediaKey = 8;
        optional string directPath = 9;
        optional string caption = 10;
        optional ContextInfo contextInfo = 11;
        optional string packDescription = 12;
        optional int64 mediaKeyTimestamp = 13;
        optional string trayIconFileName = 14;
        optional string thumbnailDirectPath = 15;
        optional bytes thumbnailSha256 = 16;
        optional bytes thumbnailEncSha256 = 17;
        optional uint32 thumbnailHeight = 18;
        optional uint32 thumbnailWidth = 19;
        optional string imageDataHash = 20;
        optional uint64 stickerPackSize = 21;
        optional StickerPackOrigin stickerPackOrigin = 22;
        message Sticker {
            optional string fileName = 1;
            optional bool isAnimated = 2;
            repeated string emojis = 3;
            optional string accessibilityLabel = 4;
            optional bool isLottie = 5;
            optional string mimetype = 6;
        }
        enum StickerPackOrigin {
            FIRST_PARTY = 0;
            THIRD_PARTY = 1;
            USER_CREATED = 2;
        }
    }
    message StickerSyncRMRMessage {
        repeated string filehash = 1;
        optional string rmrSource = 2;
        optional int64 requestTimestamp = 3;
    }
    message TemplateButtonReplyMessage {
        optional string selectedId = 1;
        optional string selectedDisplayText = 2;
        optional ContextInfo contextInfo = 3;
        optional uint32 selectedIndex = 4;
        optional uint32 selectedCarouselCardIndex = 5;
    }
    message TemplateMessage {
        optional ContextInfo contextInfo = 3;
        optional HydratedFourRowTemplate hydratedTemplate = 4;
        optional string templateId = 9;
        oneof format {
            Message.TemplateMessage.FourRowTemplate fourRowTemplate = 1;
            Message.TemplateMessage.HydratedFourRowTemplate hydratedFourRowTemplate = 2;
            Message.InteractiveMessage interactiveMessageTemplate = 5;
        }
        message FourRowTemplate {
            optional Message.HighlyStructuredMessage content = 6;
            optional Message.HighlyStructuredMessage footer = 7;
            repeated TemplateButton buttons = 8;
            oneof title {
                Message.DocumentMessage documentMessage = 1;
                Message.HighlyStructuredMessage highlyStructuredMessage = 2;
                Message.ImageMessage imageMessage = 3;
                Message.VideoMessage videoMessage = 4;
                Message.LocationMessage locationMessage = 5;
            }
        }
        message HydratedFourRowTemplate {
            optional string hydratedContentText = 6;
            optional string hydratedFooterText = 7;
            repeated HydratedTemplateButton hydratedButtons = 8;
            optional string templateId = 9;
            optional bool maskLinkedDevices = 10;
            oneof title {
                Message.DocumentMessage documentMessage = 1;
                string hydratedTitleText = 2;
                Message.ImageMessage imageMessage = 3;
                Message.VideoMessage videoMessage = 4;
                Message.LocationMessage locationMessage = 5;
            }
        }
    }
    message URLMetadata {
        optional uint32 fbExperimentId = 1;
    }
    message VideoEndCard {
        required string username = 1;
        required string caption = 2;
        required string thumbnailImageUrl = 3;
        required string profilePictureUrl = 4;
    }
    message VideoMessage {
        optional string url = 1;
        optional string mimetype = 2;
        optional bytes fileSha256 = 3;
        optional uint64 fileLength = 4;
        optional uint32 seconds = 5;
        optional bytes mediaKey = 6;
        optional string caption = 7;
        optional bool gifPlayback = 8;
        optional uint32 height = 9;
        optional uint32 width = 10;
        optional bytes fileEncSha256 = 11;
        repeated InteractiveAnnotation interactiveAnnotations = 12;
        optional string directPath = 13;
        optional int64 mediaKeyTimestamp = 14;
        optional bytes jpegThumbnail = 16;
        optional ContextInfo contextInfo = 17;
        optional bytes streamingSidecar = 18;
        optional Attribution gifAttribution = 19;
        optional bool viewOnce = 20;
        optional string thumbnailDirectPath = 21;
        optional bytes thumbnailSha256 = 22;
        optional bytes thumbnailEncSha256 = 23;
        optional string staticUrl = 24;
        repeated InteractiveAnnotation annotations = 25;
        optional string accessibilityLabel = 26;
        repeated ProcessedVideo processedVideos = 27;
        optional uint32 externalShareFullVideoDurationInSeconds = 28;
        optional uint64 motionPhotoPresentationOffsetMs = 29;
        optional string metadataUrl = 30;
        optional VideoSourceType videoSourceType = 31;
        optional Message.MediaKeyDomain mediaKeyDomain = 32;
        enum Attribution {
            NONE = 0;
            GIPHY = 1;
            TENOR = 2;
            KLIPY = 3;
        }
        enum VideoSourceType {
            USER_VIDEO = 0;
            AI_GENERATED = 1;
        }
    }
}

enum KeepType {
    UNKNOWN = 0;
    KEEP_FOR_ALL = 1;
    UNDO_KEEP_FOR_ALL = 2;
}