impl serde::Serialize for AccountData {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.profile_key.is_empty() {
            len += 1;
        }
        if self.username.is_some() {
            len += 1;
        }
        if self.username_link.is_some() {
            len += 1;
        }
        if !self.given_name.is_empty() {
            len += 1;
        }
        if !self.family_name.is_empty() {
            len += 1;
        }
        if !self.avatar_url_path.is_empty() {
            len += 1;
        }
        if self.donation_subscriber_data.is_some() {
            len += 1;
        }
        if self.account_settings.is_some() {
            len += 1;
        }
        if self.backups_subscriber_data.is_some() {
            len += 1;
        }
        if !self.svr_pin.is_empty() {
            len += 1;
        }
        if self.android_specific_settings.is_some() {
            len += 1;
        }
        if !self.bio_text.is_empty() {
            len += 1;
        }
        if !self.bio_emoji.is_empty() {
            len += 1;
        }
        if self.key_transparency_data.is_some() {
            len += 1;
        }
        if self.ios_specific_settings.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.AccountData", len)?;
        if !self.profile_key.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("profileKey", pbjson::private::base64::encode(&self.profile_key).as_str())?;
        }
        if let Some(v) = self.username.as_ref() {
            struct_ser.serialize_field("username", v)?;
        }
        if let Some(v) = self.username_link.as_ref() {
            struct_ser.serialize_field("usernameLink", v)?;
        }
        if !self.given_name.is_empty() {
            struct_ser.serialize_field("givenName", &self.given_name)?;
        }
        if !self.family_name.is_empty() {
            struct_ser.serialize_field("familyName", &self.family_name)?;
        }
        if !self.avatar_url_path.is_empty() {
            struct_ser.serialize_field("avatarUrlPath", &self.avatar_url_path)?;
        }
        if let Some(v) = self.donation_subscriber_data.as_ref() {
            struct_ser.serialize_field("donationSubscriberData", v)?;
        }
        if let Some(v) = self.account_settings.as_ref() {
            struct_ser.serialize_field("accountSettings", v)?;
        }
        if let Some(v) = self.backups_subscriber_data.as_ref() {
            struct_ser.serialize_field("backupsSubscriberData", v)?;
        }
        if !self.svr_pin.is_empty() {
            struct_ser.serialize_field("svrPin", &self.svr_pin)?;
        }
        if let Some(v) = self.android_specific_settings.as_ref() {
            struct_ser.serialize_field("androidSpecificSettings", v)?;
        }
        if !self.bio_text.is_empty() {
            struct_ser.serialize_field("bioText", &self.bio_text)?;
        }
        if !self.bio_emoji.is_empty() {
            struct_ser.serialize_field("bioEmoji", &self.bio_emoji)?;
        }
        if let Some(v) = self.key_transparency_data.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("keyTransparencyData", pbjson::private::base64::encode(&v).as_str())?;
        }
        if let Some(v) = self.ios_specific_settings.as_ref() {
            struct_ser.serialize_field("iosSpecificSettings", v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for AccountData {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "profileKey",
            "username",
            "usernameLink",
            "givenName",
            "familyName",
            "avatarUrlPath",
            "donationSubscriberData",
            "accountSettings",
            "backupsSubscriberData",
            "svrPin",
            "androidSpecificSettings",
            "bioText",
            "bioEmoji",
            "keyTransparencyData",
            "iosSpecificSettings",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            ProfileKey,
            Username,
            UsernameLink,
            GivenName,
            FamilyName,
            AvatarUrlPath,
            DonationSubscriberData,
            AccountSettings,
            BackupsSubscriberData,
            SvrPin,
            AndroidSpecificSettings,
            BioText,
            BioEmoji,
            KeyTransparencyData,
            IosSpecificSettings,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "profileKey" => Ok(GeneratedField::ProfileKey),
                            "username" => Ok(GeneratedField::Username),
                            "usernameLink" => Ok(GeneratedField::UsernameLink),
                            "givenName" => Ok(GeneratedField::GivenName),
                            "familyName" => Ok(GeneratedField::FamilyName),
                            "avatarUrlPath" => Ok(GeneratedField::AvatarUrlPath),
                            "donationSubscriberData" => Ok(GeneratedField::DonationSubscriberData),
                            "accountSettings" => Ok(GeneratedField::AccountSettings),
                            "backupsSubscriberData" => Ok(GeneratedField::BackupsSubscriberData),
                            "svrPin" => Ok(GeneratedField::SvrPin),
                            "androidSpecificSettings" => Ok(GeneratedField::AndroidSpecificSettings),
                            "bioText" => Ok(GeneratedField::BioText),
                            "bioEmoji" => Ok(GeneratedField::BioEmoji),
                            "keyTransparencyData" => Ok(GeneratedField::KeyTransparencyData),
                            "iosSpecificSettings" => Ok(GeneratedField::IosSpecificSettings),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = AccountData;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.AccountData")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<AccountData, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut profile_key__ = None;
                let mut username__ = None;
                let mut username_link__ = None;
                let mut given_name__ = None;
                let mut family_name__ = None;
                let mut avatar_url_path__ = None;
                let mut donation_subscriber_data__ = None;
                let mut account_settings__ = None;
                let mut backups_subscriber_data__ = None;
                let mut svr_pin__ = None;
                let mut android_specific_settings__ = None;
                let mut bio_text__ = None;
                let mut bio_emoji__ = None;
                let mut key_transparency_data__ = None;
                let mut ios_specific_settings__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::ProfileKey => {
                            if profile_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("profileKey"));
                            }
                            profile_key__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Username => {
                            if username__.is_some() {
                                return Err(serde::de::Error::duplicate_field("username"));
                            }
                            username__ = map_.next_value()?;
                        }
                        GeneratedField::UsernameLink => {
                            if username_link__.is_some() {
                                return Err(serde::de::Error::duplicate_field("usernameLink"));
                            }
                            username_link__ = map_.next_value()?;
                        }
                        GeneratedField::GivenName => {
                            if given_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("givenName"));
                            }
                            given_name__ = Some(map_.next_value()?);
                        }
                        GeneratedField::FamilyName => {
                            if family_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("familyName"));
                            }
                            family_name__ = Some(map_.next_value()?);
                        }
                        GeneratedField::AvatarUrlPath => {
                            if avatar_url_path__.is_some() {
                                return Err(serde::de::Error::duplicate_field("avatarUrlPath"));
                            }
                            avatar_url_path__ = Some(map_.next_value()?);
                        }
                        GeneratedField::DonationSubscriberData => {
                            if donation_subscriber_data__.is_some() {
                                return Err(serde::de::Error::duplicate_field("donationSubscriberData"));
                            }
                            donation_subscriber_data__ = map_.next_value()?;
                        }
                        GeneratedField::AccountSettings => {
                            if account_settings__.is_some() {
                                return Err(serde::de::Error::duplicate_field("accountSettings"));
                            }
                            account_settings__ = map_.next_value()?;
                        }
                        GeneratedField::BackupsSubscriberData => {
                            if backups_subscriber_data__.is_some() {
                                return Err(serde::de::Error::duplicate_field("backupsSubscriberData"));
                            }
                            backups_subscriber_data__ = map_.next_value()?;
                        }
                        GeneratedField::SvrPin => {
                            if svr_pin__.is_some() {
                                return Err(serde::de::Error::duplicate_field("svrPin"));
                            }
                            svr_pin__ = Some(map_.next_value()?);
                        }
                        GeneratedField::AndroidSpecificSettings => {
                            if android_specific_settings__.is_some() {
                                return Err(serde::de::Error::duplicate_field("androidSpecificSettings"));
                            }
                            android_specific_settings__ = map_.next_value()?;
                        }
                        GeneratedField::BioText => {
                            if bio_text__.is_some() {
                                return Err(serde::de::Error::duplicate_field("bioText"));
                            }
                            bio_text__ = Some(map_.next_value()?);
                        }
                        GeneratedField::BioEmoji => {
                            if bio_emoji__.is_some() {
                                return Err(serde::de::Error::duplicate_field("bioEmoji"));
                            }
                            bio_emoji__ = Some(map_.next_value()?);
                        }
                        GeneratedField::KeyTransparencyData => {
                            if key_transparency_data__.is_some() {
                                return Err(serde::de::Error::duplicate_field("keyTransparencyData"));
                            }
                            key_transparency_data__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::IosSpecificSettings => {
                            if ios_specific_settings__.is_some() {
                                return Err(serde::de::Error::duplicate_field("iosSpecificSettings"));
                            }
                            ios_specific_settings__ = map_.next_value()?;
                        }
                    }
                }
                Ok(AccountData {
                    profile_key: profile_key__.unwrap_or_default(),
                    username: username__,
                    username_link: username_link__,
                    given_name: given_name__.unwrap_or_default(),
                    family_name: family_name__.unwrap_or_default(),
                    avatar_url_path: avatar_url_path__.unwrap_or_default(),
                    donation_subscriber_data: donation_subscriber_data__,
                    account_settings: account_settings__,
                    backups_subscriber_data: backups_subscriber_data__,
                    svr_pin: svr_pin__.unwrap_or_default(),
                    android_specific_settings: android_specific_settings__,
                    bio_text: bio_text__.unwrap_or_default(),
                    bio_emoji: bio_emoji__.unwrap_or_default(),
                    key_transparency_data: key_transparency_data__,
                    ios_specific_settings: ios_specific_settings__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.AccountData", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::AccountSettings {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.read_receipts {
            len += 1;
        }
        if self.sealed_sender_indicators {
            len += 1;
        }
        if self.typing_indicators {
            len += 1;
        }
        if self.link_previews {
            len += 1;
        }
        if self.not_discoverable_by_phone_number {
            len += 1;
        }
        if self.prefer_contact_avatars {
            len += 1;
        }
        if self.universal_expire_timer_seconds != 0 {
            len += 1;
        }
        if !self.preferred_reaction_emoji.is_empty() {
            len += 1;
        }
        if self.display_badges_on_profile {
            len += 1;
        }
        if self.keep_muted_chats_archived {
            len += 1;
        }
        if self.has_set_my_stories_privacy {
            len += 1;
        }
        if self.has_viewed_onboarding_story {
            len += 1;
        }
        if self.stories_disabled {
            len += 1;
        }
        if self.story_view_receipts_enabled.is_some() {
            len += 1;
        }
        if self.has_seen_group_story_education_sheet {
            len += 1;
        }
        if self.has_completed_username_onboarding {
            len += 1;
        }
        if self.phone_number_sharing_mode != 0 {
            len += 1;
        }
        if self.default_chat_style.is_some() {
            len += 1;
        }
        if !self.custom_chat_colors.is_empty() {
            len += 1;
        }
        if self.optimize_on_device_storage {
            len += 1;
        }
        if self.backup_tier.is_some() {
            len += 1;
        }
        if self.default_sent_media_quality != 0 {
            len += 1;
        }
        if self.auto_download_settings.is_some() {
            len += 1;
        }
        if self.screen_lock_timeout_minutes.is_some() {
            len += 1;
        }
        if self.pin_reminders.is_some() {
            len += 1;
        }
        if self.app_theme != 0 {
            len += 1;
        }
        if self.calls_use_less_data_setting != 0 {
            len += 1;
        }
        if self.allow_sealed_sender_from_anyone {
            len += 1;
        }
        if self.allow_automatic_key_verification {
            len += 1;
        }
        if self.has_seen_admin_delete_education_dialog {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.AccountData.AccountSettings", len)?;
        if self.read_receipts {
            struct_ser.serialize_field("readReceipts", &self.read_receipts)?;
        }
        if self.sealed_sender_indicators {
            struct_ser.serialize_field("sealedSenderIndicators", &self.sealed_sender_indicators)?;
        }
        if self.typing_indicators {
            struct_ser.serialize_field("typingIndicators", &self.typing_indicators)?;
        }
        if self.link_previews {
            struct_ser.serialize_field("linkPreviews", &self.link_previews)?;
        }
        if self.not_discoverable_by_phone_number {
            struct_ser.serialize_field("notDiscoverableByPhoneNumber", &self.not_discoverable_by_phone_number)?;
        }
        if self.prefer_contact_avatars {
            struct_ser.serialize_field("preferContactAvatars", &self.prefer_contact_avatars)?;
        }
        if self.universal_expire_timer_seconds != 0 {
            struct_ser.serialize_field("universalExpireTimerSeconds", &self.universal_expire_timer_seconds)?;
        }
        if !self.preferred_reaction_emoji.is_empty() {
            struct_ser.serialize_field("preferredReactionEmoji", &self.preferred_reaction_emoji)?;
        }
        if self.display_badges_on_profile {
            struct_ser.serialize_field("displayBadgesOnProfile", &self.display_badges_on_profile)?;
        }
        if self.keep_muted_chats_archived {
            struct_ser.serialize_field("keepMutedChatsArchived", &self.keep_muted_chats_archived)?;
        }
        if self.has_set_my_stories_privacy {
            struct_ser.serialize_field("hasSetMyStoriesPrivacy", &self.has_set_my_stories_privacy)?;
        }
        if self.has_viewed_onboarding_story {
            struct_ser.serialize_field("hasViewedOnboardingStory", &self.has_viewed_onboarding_story)?;
        }
        if self.stories_disabled {
            struct_ser.serialize_field("storiesDisabled", &self.stories_disabled)?;
        }
        if let Some(v) = self.story_view_receipts_enabled.as_ref() {
            struct_ser.serialize_field("storyViewReceiptsEnabled", v)?;
        }
        if self.has_seen_group_story_education_sheet {
            struct_ser.serialize_field("hasSeenGroupStoryEducationSheet", &self.has_seen_group_story_education_sheet)?;
        }
        if self.has_completed_username_onboarding {
            struct_ser.serialize_field("hasCompletedUsernameOnboarding", &self.has_completed_username_onboarding)?;
        }
        if self.phone_number_sharing_mode != 0 {
            let v = account_data::PhoneNumberSharingMode::try_from(self.phone_number_sharing_mode)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.phone_number_sharing_mode)))?;
            struct_ser.serialize_field("phoneNumberSharingMode", &v)?;
        }
        if let Some(v) = self.default_chat_style.as_ref() {
            struct_ser.serialize_field("defaultChatStyle", v)?;
        }
        if !self.custom_chat_colors.is_empty() {
            struct_ser.serialize_field("customChatColors", &self.custom_chat_colors)?;
        }
        if self.optimize_on_device_storage {
            struct_ser.serialize_field("optimizeOnDeviceStorage", &self.optimize_on_device_storage)?;
        }
        if let Some(v) = self.backup_tier.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("backupTier", ToString::to_string(&v).as_str())?;
        }
        if self.default_sent_media_quality != 0 {
            let v = account_data::SentMediaQuality::try_from(self.default_sent_media_quality)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.default_sent_media_quality)))?;
            struct_ser.serialize_field("defaultSentMediaQuality", &v)?;
        }
        if let Some(v) = self.auto_download_settings.as_ref() {
            struct_ser.serialize_field("autoDownloadSettings", v)?;
        }
        if let Some(v) = self.screen_lock_timeout_minutes.as_ref() {
            struct_ser.serialize_field("screenLockTimeoutMinutes", v)?;
        }
        if let Some(v) = self.pin_reminders.as_ref() {
            struct_ser.serialize_field("pinReminders", v)?;
        }
        if self.app_theme != 0 {
            let v = account_data::AppTheme::try_from(self.app_theme)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.app_theme)))?;
            struct_ser.serialize_field("appTheme", &v)?;
        }
        if self.calls_use_less_data_setting != 0 {
            let v = account_data::CallsUseLessDataSetting::try_from(self.calls_use_less_data_setting)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.calls_use_less_data_setting)))?;
            struct_ser.serialize_field("callsUseLessDataSetting", &v)?;
        }
        if self.allow_sealed_sender_from_anyone {
            struct_ser.serialize_field("allowSealedSenderFromAnyone", &self.allow_sealed_sender_from_anyone)?;
        }
        if self.allow_automatic_key_verification {
            struct_ser.serialize_field("allowAutomaticKeyVerification", &self.allow_automatic_key_verification)?;
        }
        if self.has_seen_admin_delete_education_dialog {
            struct_ser.serialize_field("hasSeenAdminDeleteEducationDialog", &self.has_seen_admin_delete_education_dialog)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for account_data::AccountSettings {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "readReceipts",
            "sealedSenderIndicators",
            "typingIndicators",
            "linkPreviews",
            "notDiscoverableByPhoneNumber",
            "preferContactAvatars",
            "universalExpireTimerSeconds",
            "preferredReactionEmoji",
            "displayBadgesOnProfile",
            "keepMutedChatsArchived",
            "hasSetMyStoriesPrivacy",
            "hasViewedOnboardingStory",
            "storiesDisabled",
            "storyViewReceiptsEnabled",
            "hasSeenGroupStoryEducationSheet",
            "hasCompletedUsernameOnboarding",
            "phoneNumberSharingMode",
            "defaultChatStyle",
            "customChatColors",
            "optimizeOnDeviceStorage",
            "backupTier",
            "defaultSentMediaQuality",
            "autoDownloadSettings",
            "screenLockTimeoutMinutes",
            "pinReminders",
            "appTheme",
            "callsUseLessDataSetting",
            "allowSealedSenderFromAnyone",
            "allowAutomaticKeyVerification",
            "hasSeenAdminDeleteEducationDialog",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            ReadReceipts,
            SealedSenderIndicators,
            TypingIndicators,
            LinkPreviews,
            NotDiscoverableByPhoneNumber,
            PreferContactAvatars,
            UniversalExpireTimerSeconds,
            PreferredReactionEmoji,
            DisplayBadgesOnProfile,
            KeepMutedChatsArchived,
            HasSetMyStoriesPrivacy,
            HasViewedOnboardingStory,
            StoriesDisabled,
            StoryViewReceiptsEnabled,
            HasSeenGroupStoryEducationSheet,
            HasCompletedUsernameOnboarding,
            PhoneNumberSharingMode,
            DefaultChatStyle,
            CustomChatColors,
            OptimizeOnDeviceStorage,
            BackupTier,
            DefaultSentMediaQuality,
            AutoDownloadSettings,
            ScreenLockTimeoutMinutes,
            PinReminders,
            AppTheme,
            CallsUseLessDataSetting,
            AllowSealedSenderFromAnyone,
            AllowAutomaticKeyVerification,
            HasSeenAdminDeleteEducationDialog,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "readReceipts" => Ok(GeneratedField::ReadReceipts),
                            "sealedSenderIndicators" => Ok(GeneratedField::SealedSenderIndicators),
                            "typingIndicators" => Ok(GeneratedField::TypingIndicators),
                            "linkPreviews" => Ok(GeneratedField::LinkPreviews),
                            "notDiscoverableByPhoneNumber" => Ok(GeneratedField::NotDiscoverableByPhoneNumber),
                            "preferContactAvatars" => Ok(GeneratedField::PreferContactAvatars),
                            "universalExpireTimerSeconds" => Ok(GeneratedField::UniversalExpireTimerSeconds),
                            "preferredReactionEmoji" => Ok(GeneratedField::PreferredReactionEmoji),
                            "displayBadgesOnProfile" => Ok(GeneratedField::DisplayBadgesOnProfile),
                            "keepMutedChatsArchived" => Ok(GeneratedField::KeepMutedChatsArchived),
                            "hasSetMyStoriesPrivacy" => Ok(GeneratedField::HasSetMyStoriesPrivacy),
                            "hasViewedOnboardingStory" => Ok(GeneratedField::HasViewedOnboardingStory),
                            "storiesDisabled" => Ok(GeneratedField::StoriesDisabled),
                            "storyViewReceiptsEnabled" => Ok(GeneratedField::StoryViewReceiptsEnabled),
                            "hasSeenGroupStoryEducationSheet" => Ok(GeneratedField::HasSeenGroupStoryEducationSheet),
                            "hasCompletedUsernameOnboarding" => Ok(GeneratedField::HasCompletedUsernameOnboarding),
                            "phoneNumberSharingMode" => Ok(GeneratedField::PhoneNumberSharingMode),
                            "defaultChatStyle" => Ok(GeneratedField::DefaultChatStyle),
                            "customChatColors" => Ok(GeneratedField::CustomChatColors),
                            "optimizeOnDeviceStorage" => Ok(GeneratedField::OptimizeOnDeviceStorage),
                            "backupTier" => Ok(GeneratedField::BackupTier),
                            "defaultSentMediaQuality" => Ok(GeneratedField::DefaultSentMediaQuality),
                            "autoDownloadSettings" => Ok(GeneratedField::AutoDownloadSettings),
                            "screenLockTimeoutMinutes" => Ok(GeneratedField::ScreenLockTimeoutMinutes),
                            "pinReminders" => Ok(GeneratedField::PinReminders),
                            "appTheme" => Ok(GeneratedField::AppTheme),
                            "callsUseLessDataSetting" => Ok(GeneratedField::CallsUseLessDataSetting),
                            "allowSealedSenderFromAnyone" => Ok(GeneratedField::AllowSealedSenderFromAnyone),
                            "allowAutomaticKeyVerification" => Ok(GeneratedField::AllowAutomaticKeyVerification),
                            "hasSeenAdminDeleteEducationDialog" => Ok(GeneratedField::HasSeenAdminDeleteEducationDialog),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = account_data::AccountSettings;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.AccountData.AccountSettings")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<account_data::AccountSettings, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut read_receipts__ = None;
                let mut sealed_sender_indicators__ = None;
                let mut typing_indicators__ = None;
                let mut link_previews__ = None;
                let mut not_discoverable_by_phone_number__ = None;
                let mut prefer_contact_avatars__ = None;
                let mut universal_expire_timer_seconds__ = None;
                let mut preferred_reaction_emoji__ = None;
                let mut display_badges_on_profile__ = None;
                let mut keep_muted_chats_archived__ = None;
                let mut has_set_my_stories_privacy__ = None;
                let mut has_viewed_onboarding_story__ = None;
                let mut stories_disabled__ = None;
                let mut story_view_receipts_enabled__ = None;
                let mut has_seen_group_story_education_sheet__ = None;
                let mut has_completed_username_onboarding__ = None;
                let mut phone_number_sharing_mode__ = None;
                let mut default_chat_style__ = None;
                let mut custom_chat_colors__ = None;
                let mut optimize_on_device_storage__ = None;
                let mut backup_tier__ = None;
                let mut default_sent_media_quality__ = None;
                let mut auto_download_settings__ = None;
                let mut screen_lock_timeout_minutes__ = None;
                let mut pin_reminders__ = None;
                let mut app_theme__ = None;
                let mut calls_use_less_data_setting__ = None;
                let mut allow_sealed_sender_from_anyone__ = None;
                let mut allow_automatic_key_verification__ = None;
                let mut has_seen_admin_delete_education_dialog__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::ReadReceipts => {
                            if read_receipts__.is_some() {
                                return Err(serde::de::Error::duplicate_field("readReceipts"));
                            }
                            read_receipts__ = Some(map_.next_value()?);
                        }
                        GeneratedField::SealedSenderIndicators => {
                            if sealed_sender_indicators__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sealedSenderIndicators"));
                            }
                            sealed_sender_indicators__ = Some(map_.next_value()?);
                        }
                        GeneratedField::TypingIndicators => {
                            if typing_indicators__.is_some() {
                                return Err(serde::de::Error::duplicate_field("typingIndicators"));
                            }
                            typing_indicators__ = Some(map_.next_value()?);
                        }
                        GeneratedField::LinkPreviews => {
                            if link_previews__.is_some() {
                                return Err(serde::de::Error::duplicate_field("linkPreviews"));
                            }
                            link_previews__ = Some(map_.next_value()?);
                        }
                        GeneratedField::NotDiscoverableByPhoneNumber => {
                            if not_discoverable_by_phone_number__.is_some() {
                                return Err(serde::de::Error::duplicate_field("notDiscoverableByPhoneNumber"));
                            }
                            not_discoverable_by_phone_number__ = Some(map_.next_value()?);
                        }
                        GeneratedField::PreferContactAvatars => {
                            if prefer_contact_avatars__.is_some() {
                                return Err(serde::de::Error::duplicate_field("preferContactAvatars"));
                            }
                            prefer_contact_avatars__ = Some(map_.next_value()?);
                        }
                        GeneratedField::UniversalExpireTimerSeconds => {
                            if universal_expire_timer_seconds__.is_some() {
                                return Err(serde::de::Error::duplicate_field("universalExpireTimerSeconds"));
                            }
                            universal_expire_timer_seconds__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::PreferredReactionEmoji => {
                            if preferred_reaction_emoji__.is_some() {
                                return Err(serde::de::Error::duplicate_field("preferredReactionEmoji"));
                            }
                            preferred_reaction_emoji__ = Some(map_.next_value()?);
                        }
                        GeneratedField::DisplayBadgesOnProfile => {
                            if display_badges_on_profile__.is_some() {
                                return Err(serde::de::Error::duplicate_field("displayBadgesOnProfile"));
                            }
                            display_badges_on_profile__ = Some(map_.next_value()?);
                        }
                        GeneratedField::KeepMutedChatsArchived => {
                            if keep_muted_chats_archived__.is_some() {
                                return Err(serde::de::Error::duplicate_field("keepMutedChatsArchived"));
                            }
                            keep_muted_chats_archived__ = Some(map_.next_value()?);
                        }
                        GeneratedField::HasSetMyStoriesPrivacy => {
                            if has_set_my_stories_privacy__.is_some() {
                                return Err(serde::de::Error::duplicate_field("hasSetMyStoriesPrivacy"));
                            }
                            has_set_my_stories_privacy__ = Some(map_.next_value()?);
                        }
                        GeneratedField::HasViewedOnboardingStory => {
                            if has_viewed_onboarding_story__.is_some() {
                                return Err(serde::de::Error::duplicate_field("hasViewedOnboardingStory"));
                            }
                            has_viewed_onboarding_story__ = Some(map_.next_value()?);
                        }
                        GeneratedField::StoriesDisabled => {
                            if stories_disabled__.is_some() {
                                return Err(serde::de::Error::duplicate_field("storiesDisabled"));
                            }
                            stories_disabled__ = Some(map_.next_value()?);
                        }
                        GeneratedField::StoryViewReceiptsEnabled => {
                            if story_view_receipts_enabled__.is_some() {
                                return Err(serde::de::Error::duplicate_field("storyViewReceiptsEnabled"));
                            }
                            story_view_receipts_enabled__ = map_.next_value()?;
                        }
                        GeneratedField::HasSeenGroupStoryEducationSheet => {
                            if has_seen_group_story_education_sheet__.is_some() {
                                return Err(serde::de::Error::duplicate_field("hasSeenGroupStoryEducationSheet"));
                            }
                            has_seen_group_story_education_sheet__ = Some(map_.next_value()?);
                        }
                        GeneratedField::HasCompletedUsernameOnboarding => {
                            if has_completed_username_onboarding__.is_some() {
                                return Err(serde::de::Error::duplicate_field("hasCompletedUsernameOnboarding"));
                            }
                            has_completed_username_onboarding__ = Some(map_.next_value()?);
                        }
                        GeneratedField::PhoneNumberSharingMode => {
                            if phone_number_sharing_mode__.is_some() {
                                return Err(serde::de::Error::duplicate_field("phoneNumberSharingMode"));
                            }
                            phone_number_sharing_mode__ = Some(map_.next_value::<account_data::PhoneNumberSharingMode>()? as i32);
                        }
                        GeneratedField::DefaultChatStyle => {
                            if default_chat_style__.is_some() {
                                return Err(serde::de::Error::duplicate_field("defaultChatStyle"));
                            }
                            default_chat_style__ = map_.next_value()?;
                        }
                        GeneratedField::CustomChatColors => {
                            if custom_chat_colors__.is_some() {
                                return Err(serde::de::Error::duplicate_field("customChatColors"));
                            }
                            custom_chat_colors__ = Some(map_.next_value()?);
                        }
                        GeneratedField::OptimizeOnDeviceStorage => {
                            if optimize_on_device_storage__.is_some() {
                                return Err(serde::de::Error::duplicate_field("optimizeOnDeviceStorage"));
                            }
                            optimize_on_device_storage__ = Some(map_.next_value()?);
                        }
                        GeneratedField::BackupTier => {
                            if backup_tier__.is_some() {
                                return Err(serde::de::Error::duplicate_field("backupTier"));
                            }
                            backup_tier__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::DefaultSentMediaQuality => {
                            if default_sent_media_quality__.is_some() {
                                return Err(serde::de::Error::duplicate_field("defaultSentMediaQuality"));
                            }
                            default_sent_media_quality__ = Some(map_.next_value::<account_data::SentMediaQuality>()? as i32);
                        }
                        GeneratedField::AutoDownloadSettings => {
                            if auto_download_settings__.is_some() {
                                return Err(serde::de::Error::duplicate_field("autoDownloadSettings"));
                            }
                            auto_download_settings__ = map_.next_value()?;
                        }
                        GeneratedField::ScreenLockTimeoutMinutes => {
                            if screen_lock_timeout_minutes__.is_some() {
                                return Err(serde::de::Error::duplicate_field("screenLockTimeoutMinutes"));
                            }
                            screen_lock_timeout_minutes__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::PinReminders => {
                            if pin_reminders__.is_some() {
                                return Err(serde::de::Error::duplicate_field("pinReminders"));
                            }
                            pin_reminders__ = map_.next_value()?;
                        }
                        GeneratedField::AppTheme => {
                            if app_theme__.is_some() {
                                return Err(serde::de::Error::duplicate_field("appTheme"));
                            }
                            app_theme__ = Some(map_.next_value::<account_data::AppTheme>()? as i32);
                        }
                        GeneratedField::CallsUseLessDataSetting => {
                            if calls_use_less_data_setting__.is_some() {
                                return Err(serde::de::Error::duplicate_field("callsUseLessDataSetting"));
                            }
                            calls_use_less_data_setting__ = Some(map_.next_value::<account_data::CallsUseLessDataSetting>()? as i32);
                        }
                        GeneratedField::AllowSealedSenderFromAnyone => {
                            if allow_sealed_sender_from_anyone__.is_some() {
                                return Err(serde::de::Error::duplicate_field("allowSealedSenderFromAnyone"));
                            }
                            allow_sealed_sender_from_anyone__ = Some(map_.next_value()?);
                        }
                        GeneratedField::AllowAutomaticKeyVerification => {
                            if allow_automatic_key_verification__.is_some() {
                                return Err(serde::de::Error::duplicate_field("allowAutomaticKeyVerification"));
                            }
                            allow_automatic_key_verification__ = Some(map_.next_value()?);
                        }
                        GeneratedField::HasSeenAdminDeleteEducationDialog => {
                            if has_seen_admin_delete_education_dialog__.is_some() {
                                return Err(serde::de::Error::duplicate_field("hasSeenAdminDeleteEducationDialog"));
                            }
                            has_seen_admin_delete_education_dialog__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(account_data::AccountSettings {
                    read_receipts: read_receipts__.unwrap_or_default(),
                    sealed_sender_indicators: sealed_sender_indicators__.unwrap_or_default(),
                    typing_indicators: typing_indicators__.unwrap_or_default(),
                    link_previews: link_previews__.unwrap_or_default(),
                    not_discoverable_by_phone_number: not_discoverable_by_phone_number__.unwrap_or_default(),
                    prefer_contact_avatars: prefer_contact_avatars__.unwrap_or_default(),
                    universal_expire_timer_seconds: universal_expire_timer_seconds__.unwrap_or_default(),
                    preferred_reaction_emoji: preferred_reaction_emoji__.unwrap_or_default(),
                    display_badges_on_profile: display_badges_on_profile__.unwrap_or_default(),
                    keep_muted_chats_archived: keep_muted_chats_archived__.unwrap_or_default(),
                    has_set_my_stories_privacy: has_set_my_stories_privacy__.unwrap_or_default(),
                    has_viewed_onboarding_story: has_viewed_onboarding_story__.unwrap_or_default(),
                    stories_disabled: stories_disabled__.unwrap_or_default(),
                    story_view_receipts_enabled: story_view_receipts_enabled__,
                    has_seen_group_story_education_sheet: has_seen_group_story_education_sheet__.unwrap_or_default(),
                    has_completed_username_onboarding: has_completed_username_onboarding__.unwrap_or_default(),
                    phone_number_sharing_mode: phone_number_sharing_mode__.unwrap_or_default(),
                    default_chat_style: default_chat_style__,
                    custom_chat_colors: custom_chat_colors__.unwrap_or_default(),
                    optimize_on_device_storage: optimize_on_device_storage__.unwrap_or_default(),
                    backup_tier: backup_tier__,
                    default_sent_media_quality: default_sent_media_quality__.unwrap_or_default(),
                    auto_download_settings: auto_download_settings__,
                    screen_lock_timeout_minutes: screen_lock_timeout_minutes__,
                    pin_reminders: pin_reminders__,
                    app_theme: app_theme__.unwrap_or_default(),
                    calls_use_less_data_setting: calls_use_less_data_setting__.unwrap_or_default(),
                    allow_sealed_sender_from_anyone: allow_sealed_sender_from_anyone__.unwrap_or_default(),
                    allow_automatic_key_verification: allow_automatic_key_verification__.unwrap_or_default(),
                    has_seen_admin_delete_education_dialog: has_seen_admin_delete_education_dialog__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.AccountData.AccountSettings", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::AndroidSpecificSettings {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.use_system_emoji {
            len += 1;
        }
        if self.screenshot_security {
            len += 1;
        }
        if self.navigation_bar_size != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.AccountData.AndroidSpecificSettings", len)?;
        if self.use_system_emoji {
            struct_ser.serialize_field("useSystemEmoji", &self.use_system_emoji)?;
        }
        if self.screenshot_security {
            struct_ser.serialize_field("screenshotSecurity", &self.screenshot_security)?;
        }
        if self.navigation_bar_size != 0 {
            let v = account_data::android_specific_settings::NavigationBarSize::try_from(self.navigation_bar_size)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.navigation_bar_size)))?;
            struct_ser.serialize_field("navigationBarSize", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for account_data::AndroidSpecificSettings {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "useSystemEmoji",
            "screenshotSecurity",
            "navigationBarSize",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UseSystemEmoji,
            ScreenshotSecurity,
            NavigationBarSize,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "useSystemEmoji" => Ok(GeneratedField::UseSystemEmoji),
                            "screenshotSecurity" => Ok(GeneratedField::ScreenshotSecurity),
                            "navigationBarSize" => Ok(GeneratedField::NavigationBarSize),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = account_data::AndroidSpecificSettings;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.AccountData.AndroidSpecificSettings")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<account_data::AndroidSpecificSettings, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut use_system_emoji__ = None;
                let mut screenshot_security__ = None;
                let mut navigation_bar_size__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UseSystemEmoji => {
                            if use_system_emoji__.is_some() {
                                return Err(serde::de::Error::duplicate_field("useSystemEmoji"));
                            }
                            use_system_emoji__ = Some(map_.next_value()?);
                        }
                        GeneratedField::ScreenshotSecurity => {
                            if screenshot_security__.is_some() {
                                return Err(serde::de::Error::duplicate_field("screenshotSecurity"));
                            }
                            screenshot_security__ = Some(map_.next_value()?);
                        }
                        GeneratedField::NavigationBarSize => {
                            if navigation_bar_size__.is_some() {
                                return Err(serde::de::Error::duplicate_field("navigationBarSize"));
                            }
                            navigation_bar_size__ = Some(map_.next_value::<account_data::android_specific_settings::NavigationBarSize>()? as i32);
                        }
                    }
                }
                Ok(account_data::AndroidSpecificSettings {
                    use_system_emoji: use_system_emoji__.unwrap_or_default(),
                    screenshot_security: screenshot_security__.unwrap_or_default(),
                    navigation_bar_size: navigation_bar_size__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.AccountData.AndroidSpecificSettings", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::android_specific_settings::NavigationBarSize {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::UnknownBarSize => "UNKNOWN_BAR_SIZE",
            Self::Normal => "NORMAL",
            Self::Compact => "COMPACT",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for account_data::android_specific_settings::NavigationBarSize {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN_BAR_SIZE",
            "NORMAL",
            "COMPACT",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = account_data::android_specific_settings::NavigationBarSize;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN_BAR_SIZE" => Ok(account_data::android_specific_settings::NavigationBarSize::UnknownBarSize),
                    "NORMAL" => Ok(account_data::android_specific_settings::NavigationBarSize::Normal),
                    "COMPACT" => Ok(account_data::android_specific_settings::NavigationBarSize::Compact),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::AppTheme {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::UnknownAppTheme => "UNKNOWN_APP_THEME",
            Self::System => "SYSTEM",
            Self::Light => "LIGHT",
            Self::Dark => "DARK",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for account_data::AppTheme {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN_APP_THEME",
            "SYSTEM",
            "LIGHT",
            "DARK",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = account_data::AppTheme;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN_APP_THEME" => Ok(account_data::AppTheme::UnknownAppTheme),
                    "SYSTEM" => Ok(account_data::AppTheme::System),
                    "LIGHT" => Ok(account_data::AppTheme::Light),
                    "DARK" => Ok(account_data::AppTheme::Dark),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::AutoDownloadSettings {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.images != 0 {
            len += 1;
        }
        if self.audio != 0 {
            len += 1;
        }
        if self.video != 0 {
            len += 1;
        }
        if self.documents != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.AccountData.AutoDownloadSettings", len)?;
        if self.images != 0 {
            let v = account_data::auto_download_settings::AutoDownloadOption::try_from(self.images)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.images)))?;
            struct_ser.serialize_field("images", &v)?;
        }
        if self.audio != 0 {
            let v = account_data::auto_download_settings::AutoDownloadOption::try_from(self.audio)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.audio)))?;
            struct_ser.serialize_field("audio", &v)?;
        }
        if self.video != 0 {
            let v = account_data::auto_download_settings::AutoDownloadOption::try_from(self.video)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.video)))?;
            struct_ser.serialize_field("video", &v)?;
        }
        if self.documents != 0 {
            let v = account_data::auto_download_settings::AutoDownloadOption::try_from(self.documents)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.documents)))?;
            struct_ser.serialize_field("documents", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for account_data::AutoDownloadSettings {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "images",
            "audio",
            "video",
            "documents",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Images,
            Audio,
            Video,
            Documents,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "images" => Ok(GeneratedField::Images),
                            "audio" => Ok(GeneratedField::Audio),
                            "video" => Ok(GeneratedField::Video),
                            "documents" => Ok(GeneratedField::Documents),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = account_data::AutoDownloadSettings;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.AccountData.AutoDownloadSettings")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<account_data::AutoDownloadSettings, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut images__ = None;
                let mut audio__ = None;
                let mut video__ = None;
                let mut documents__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Images => {
                            if images__.is_some() {
                                return Err(serde::de::Error::duplicate_field("images"));
                            }
                            images__ = Some(map_.next_value::<account_data::auto_download_settings::AutoDownloadOption>()? as i32);
                        }
                        GeneratedField::Audio => {
                            if audio__.is_some() {
                                return Err(serde::de::Error::duplicate_field("audio"));
                            }
                            audio__ = Some(map_.next_value::<account_data::auto_download_settings::AutoDownloadOption>()? as i32);
                        }
                        GeneratedField::Video => {
                            if video__.is_some() {
                                return Err(serde::de::Error::duplicate_field("video"));
                            }
                            video__ = Some(map_.next_value::<account_data::auto_download_settings::AutoDownloadOption>()? as i32);
                        }
                        GeneratedField::Documents => {
                            if documents__.is_some() {
                                return Err(serde::de::Error::duplicate_field("documents"));
                            }
                            documents__ = Some(map_.next_value::<account_data::auto_download_settings::AutoDownloadOption>()? as i32);
                        }
                    }
                }
                Ok(account_data::AutoDownloadSettings {
                    images: images__.unwrap_or_default(),
                    audio: audio__.unwrap_or_default(),
                    video: video__.unwrap_or_default(),
                    documents: documents__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.AccountData.AutoDownloadSettings", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::auto_download_settings::AutoDownloadOption {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::Never => "NEVER",
            Self::Wifi => "WIFI",
            Self::WifiAndCellular => "WIFI_AND_CELLULAR",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for account_data::auto_download_settings::AutoDownloadOption {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "NEVER",
            "WIFI",
            "WIFI_AND_CELLULAR",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = account_data::auto_download_settings::AutoDownloadOption;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(account_data::auto_download_settings::AutoDownloadOption::Unknown),
                    "NEVER" => Ok(account_data::auto_download_settings::AutoDownloadOption::Never),
                    "WIFI" => Ok(account_data::auto_download_settings::AutoDownloadOption::Wifi),
                    "WIFI_AND_CELLULAR" => Ok(account_data::auto_download_settings::AutoDownloadOption::WifiAndCellular),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::CallsUseLessDataSetting {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::UnknownCallDataSetting => "UNKNOWN_CALL_DATA_SETTING",
            Self::Never => "NEVER",
            Self::MobileDataOnly => "MOBILE_DATA_ONLY",
            Self::WifiAndMobileData => "WIFI_AND_MOBILE_DATA",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for account_data::CallsUseLessDataSetting {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN_CALL_DATA_SETTING",
            "NEVER",
            "MOBILE_DATA_ONLY",
            "WIFI_AND_MOBILE_DATA",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = account_data::CallsUseLessDataSetting;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN_CALL_DATA_SETTING" => Ok(account_data::CallsUseLessDataSetting::UnknownCallDataSetting),
                    "NEVER" => Ok(account_data::CallsUseLessDataSetting::Never),
                    "MOBILE_DATA_ONLY" => Ok(account_data::CallsUseLessDataSetting::MobileDataOnly),
                    "WIFI_AND_MOBILE_DATA" => Ok(account_data::CallsUseLessDataSetting::WifiAndMobileData),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::IapSubscriberData {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.subscriber_id.is_empty() {
            len += 1;
        }
        if self.iap_subscription_id.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.AccountData.IAPSubscriberData", len)?;
        if !self.subscriber_id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("subscriberId", pbjson::private::base64::encode(&self.subscriber_id).as_str())?;
        }
        if let Some(v) = self.iap_subscription_id.as_ref() {
            match v {
                account_data::iap_subscriber_data::IapSubscriptionId::PurchaseToken(v) => {
                    struct_ser.serialize_field("purchaseToken", v)?;
                }
                account_data::iap_subscriber_data::IapSubscriptionId::OriginalTransactionId(v) => {
                    #[allow(clippy::needless_borrow)]
                    #[allow(clippy::needless_borrows_for_generic_args)]
                    struct_ser.serialize_field("originalTransactionId", ToString::to_string(&v).as_str())?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for account_data::IapSubscriberData {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "subscriberId",
            "purchaseToken",
            "originalTransactionId",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            SubscriberId,
            PurchaseToken,
            OriginalTransactionId,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "subscriberId" => Ok(GeneratedField::SubscriberId),
                            "purchaseToken" => Ok(GeneratedField::PurchaseToken),
                            "originalTransactionId" => Ok(GeneratedField::OriginalTransactionId),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = account_data::IapSubscriberData;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.AccountData.IAPSubscriberData")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<account_data::IapSubscriberData, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut subscriber_id__ = None;
                let mut iap_subscription_id__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::SubscriberId => {
                            if subscriber_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("subscriberId"));
                            }
                            subscriber_id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::PurchaseToken => {
                            if iap_subscription_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("purchaseToken"));
                            }
                            iap_subscription_id__ = map_.next_value::<::std::option::Option<_>>()?.map(account_data::iap_subscriber_data::IapSubscriptionId::PurchaseToken);
                        }
                        GeneratedField::OriginalTransactionId => {
                            if iap_subscription_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("originalTransactionId"));
                            }
                            iap_subscription_id__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| account_data::iap_subscriber_data::IapSubscriptionId::OriginalTransactionId(x.0));
                        }
                    }
                }
                Ok(account_data::IapSubscriberData {
                    subscriber_id: subscriber_id__.unwrap_or_default(),
                    iap_subscription_id: iap_subscription_id__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.AccountData.IAPSubscriberData", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::IosSpecificSettings {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.is_system_call_log_enabled {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.AccountData.IOSSpecificSettings", len)?;
        if self.is_system_call_log_enabled {
            struct_ser.serialize_field("isSystemCallLogEnabled", &self.is_system_call_log_enabled)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for account_data::IosSpecificSettings {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "isSystemCallLogEnabled",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            IsSystemCallLogEnabled,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "isSystemCallLogEnabled" => Ok(GeneratedField::IsSystemCallLogEnabled),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = account_data::IosSpecificSettings;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.AccountData.IOSSpecificSettings")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<account_data::IosSpecificSettings, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut is_system_call_log_enabled__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::IsSystemCallLogEnabled => {
                            if is_system_call_log_enabled__.is_some() {
                                return Err(serde::de::Error::duplicate_field("isSystemCallLogEnabled"));
                            }
                            is_system_call_log_enabled__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(account_data::IosSpecificSettings {
                    is_system_call_log_enabled: is_system_call_log_enabled__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.AccountData.IOSSpecificSettings", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::PhoneNumberSharingMode {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::Everybody => "EVERYBODY",
            Self::Nobody => "NOBODY",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for account_data::PhoneNumberSharingMode {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "EVERYBODY",
            "NOBODY",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = account_data::PhoneNumberSharingMode;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(account_data::PhoneNumberSharingMode::Unknown),
                    "EVERYBODY" => Ok(account_data::PhoneNumberSharingMode::Everybody),
                    "NOBODY" => Ok(account_data::PhoneNumberSharingMode::Nobody),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::SentMediaQuality {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::UnknownQuality => "UNKNOWN_QUALITY",
            Self::Standard => "STANDARD",
            Self::High => "HIGH",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for account_data::SentMediaQuality {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN_QUALITY",
            "STANDARD",
            "HIGH",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = account_data::SentMediaQuality;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN_QUALITY" => Ok(account_data::SentMediaQuality::UnknownQuality),
                    "STANDARD" => Ok(account_data::SentMediaQuality::Standard),
                    "HIGH" => Ok(account_data::SentMediaQuality::High),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::SubscriberData {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.subscriber_id.is_empty() {
            len += 1;
        }
        if !self.currency_code.is_empty() {
            len += 1;
        }
        if self.manually_cancelled {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.AccountData.SubscriberData", len)?;
        if !self.subscriber_id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("subscriberId", pbjson::private::base64::encode(&self.subscriber_id).as_str())?;
        }
        if !self.currency_code.is_empty() {
            struct_ser.serialize_field("currencyCode", &self.currency_code)?;
        }
        if self.manually_cancelled {
            struct_ser.serialize_field("manuallyCancelled", &self.manually_cancelled)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for account_data::SubscriberData {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "subscriberId",
            "currencyCode",
            "manuallyCancelled",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            SubscriberId,
            CurrencyCode,
            ManuallyCancelled,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "subscriberId" => Ok(GeneratedField::SubscriberId),
                            "currencyCode" => Ok(GeneratedField::CurrencyCode),
                            "manuallyCancelled" => Ok(GeneratedField::ManuallyCancelled),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = account_data::SubscriberData;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.AccountData.SubscriberData")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<account_data::SubscriberData, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut subscriber_id__ = None;
                let mut currency_code__ = None;
                let mut manually_cancelled__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::SubscriberId => {
                            if subscriber_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("subscriberId"));
                            }
                            subscriber_id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::CurrencyCode => {
                            if currency_code__.is_some() {
                                return Err(serde::de::Error::duplicate_field("currencyCode"));
                            }
                            currency_code__ = Some(map_.next_value()?);
                        }
                        GeneratedField::ManuallyCancelled => {
                            if manually_cancelled__.is_some() {
                                return Err(serde::de::Error::duplicate_field("manuallyCancelled"));
                            }
                            manually_cancelled__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(account_data::SubscriberData {
                    subscriber_id: subscriber_id__.unwrap_or_default(),
                    currency_code: currency_code__.unwrap_or_default(),
                    manually_cancelled: manually_cancelled__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.AccountData.SubscriberData", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::UsernameLink {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.entropy.is_empty() {
            len += 1;
        }
        if !self.server_id.is_empty() {
            len += 1;
        }
        if self.color != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.AccountData.UsernameLink", len)?;
        if !self.entropy.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("entropy", pbjson::private::base64::encode(&self.entropy).as_str())?;
        }
        if !self.server_id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("serverId", pbjson::private::base64::encode(&self.server_id).as_str())?;
        }
        if self.color != 0 {
            let v = account_data::username_link::Color::try_from(self.color)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.color)))?;
            struct_ser.serialize_field("color", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for account_data::UsernameLink {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "entropy",
            "serverId",
            "color",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Entropy,
            ServerId,
            Color,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "entropy" => Ok(GeneratedField::Entropy),
                            "serverId" => Ok(GeneratedField::ServerId),
                            "color" => Ok(GeneratedField::Color),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = account_data::UsernameLink;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.AccountData.UsernameLink")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<account_data::UsernameLink, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut entropy__ = None;
                let mut server_id__ = None;
                let mut color__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Entropy => {
                            if entropy__.is_some() {
                                return Err(serde::de::Error::duplicate_field("entropy"));
                            }
                            entropy__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::ServerId => {
                            if server_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("serverId"));
                            }
                            server_id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Color => {
                            if color__.is_some() {
                                return Err(serde::de::Error::duplicate_field("color"));
                            }
                            color__ = Some(map_.next_value::<account_data::username_link::Color>()? as i32);
                        }
                    }
                }
                Ok(account_data::UsernameLink {
                    entropy: entropy__.unwrap_or_default(),
                    server_id: server_id__.unwrap_or_default(),
                    color: color__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.AccountData.UsernameLink", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for account_data::username_link::Color {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::Blue => "BLUE",
            Self::White => "WHITE",
            Self::Grey => "GREY",
            Self::Olive => "OLIVE",
            Self::Green => "GREEN",
            Self::Orange => "ORANGE",
            Self::Pink => "PINK",
            Self::Purple => "PURPLE",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for account_data::username_link::Color {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "BLUE",
            "WHITE",
            "GREY",
            "OLIVE",
            "GREEN",
            "ORANGE",
            "PINK",
            "PURPLE",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = account_data::username_link::Color;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(account_data::username_link::Color::Unknown),
                    "BLUE" => Ok(account_data::username_link::Color::Blue),
                    "WHITE" => Ok(account_data::username_link::Color::White),
                    "GREY" => Ok(account_data::username_link::Color::Grey),
                    "OLIVE" => Ok(account_data::username_link::Color::Olive),
                    "GREEN" => Ok(account_data::username_link::Color::Green),
                    "ORANGE" => Ok(account_data::username_link::Color::Orange),
                    "PINK" => Ok(account_data::username_link::Color::Pink),
                    "PURPLE" => Ok(account_data::username_link::Color::Purple),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for AdHocCall {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.call_id != 0 {
            len += 1;
        }
        if self.recipient_id != 0 {
            len += 1;
        }
        if self.state != 0 {
            len += 1;
        }
        if self.call_timestamp != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.AdHocCall", len)?;
        if self.call_id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("callId", ToString::to_string(&self.call_id).as_str())?;
        }
        if self.recipient_id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("recipientId", ToString::to_string(&self.recipient_id).as_str())?;
        }
        if self.state != 0 {
            let v = ad_hoc_call::State::try_from(self.state)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.state)))?;
            struct_ser.serialize_field("state", &v)?;
        }
        if self.call_timestamp != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("callTimestamp", ToString::to_string(&self.call_timestamp).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for AdHocCall {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "callId",
            "recipientId",
            "state",
            "callTimestamp",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            CallId,
            RecipientId,
            State,
            CallTimestamp,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "callId" => Ok(GeneratedField::CallId),
                            "recipientId" => Ok(GeneratedField::RecipientId),
                            "state" => Ok(GeneratedField::State),
                            "callTimestamp" => Ok(GeneratedField::CallTimestamp),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = AdHocCall;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.AdHocCall")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<AdHocCall, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut call_id__ = None;
                let mut recipient_id__ = None;
                let mut state__ = None;
                let mut call_timestamp__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::CallId => {
                            if call_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("callId"));
                            }
                            call_id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::RecipientId => {
                            if recipient_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("recipientId"));
                            }
                            recipient_id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::State => {
                            if state__.is_some() {
                                return Err(serde::de::Error::duplicate_field("state"));
                            }
                            state__ = Some(map_.next_value::<ad_hoc_call::State>()? as i32);
                        }
                        GeneratedField::CallTimestamp => {
                            if call_timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("callTimestamp"));
                            }
                            call_timestamp__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(AdHocCall {
                    call_id: call_id__.unwrap_or_default(),
                    recipient_id: recipient_id__.unwrap_or_default(),
                    state: state__.unwrap_or_default(),
                    call_timestamp: call_timestamp__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.AdHocCall", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for ad_hoc_call::State {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::UnknownState => "UNKNOWN_STATE",
            Self::Generic => "GENERIC",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for ad_hoc_call::State {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN_STATE",
            "GENERIC",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = ad_hoc_call::State;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN_STATE" => Ok(ad_hoc_call::State::UnknownState),
                    "GENERIC" => Ok(ad_hoc_call::State::Generic),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for AdminDeletedMessage {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.admin_id != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.AdminDeletedMessage", len)?;
        if self.admin_id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("adminId", ToString::to_string(&self.admin_id).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for AdminDeletedMessage {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "adminId",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            AdminId,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "adminId" => Ok(GeneratedField::AdminId),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = AdminDeletedMessage;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.AdminDeletedMessage")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<AdminDeletedMessage, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut admin_id__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::AdminId => {
                            if admin_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("adminId"));
                            }
                            admin_id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(AdminDeletedMessage {
                    admin_id: admin_id__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.AdminDeletedMessage", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for AvatarColor {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::A100 => "A100",
            Self::A110 => "A110",
            Self::A120 => "A120",
            Self::A130 => "A130",
            Self::A140 => "A140",
            Self::A150 => "A150",
            Self::A160 => "A160",
            Self::A170 => "A170",
            Self::A180 => "A180",
            Self::A190 => "A190",
            Self::A200 => "A200",
            Self::A210 => "A210",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for AvatarColor {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "A100",
            "A110",
            "A120",
            "A130",
            "A140",
            "A150",
            "A160",
            "A170",
            "A180",
            "A190",
            "A200",
            "A210",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = AvatarColor;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "A100" => Ok(AvatarColor::A100),
                    "A110" => Ok(AvatarColor::A110),
                    "A120" => Ok(AvatarColor::A120),
                    "A130" => Ok(AvatarColor::A130),
                    "A140" => Ok(AvatarColor::A140),
                    "A150" => Ok(AvatarColor::A150),
                    "A160" => Ok(AvatarColor::A160),
                    "A170" => Ok(AvatarColor::A170),
                    "A180" => Ok(AvatarColor::A180),
                    "A190" => Ok(AvatarColor::A190),
                    "A200" => Ok(AvatarColor::A200),
                    "A210" => Ok(AvatarColor::A210),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for BackupInfo {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.version != 0 {
            len += 1;
        }
        if self.backup_time_ms != 0 {
            len += 1;
        }
        if !self.media_root_backup_key.is_empty() {
            len += 1;
        }
        if !self.current_app_version.is_empty() {
            len += 1;
        }
        if !self.first_app_version.is_empty() {
            len += 1;
        }
        if !self.debug_info.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.BackupInfo", len)?;
        if self.version != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("version", ToString::to_string(&self.version).as_str())?;
        }
        if self.backup_time_ms != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("backupTimeMs", ToString::to_string(&self.backup_time_ms).as_str())?;
        }
        if !self.media_root_backup_key.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("mediaRootBackupKey", pbjson::private::base64::encode(&self.media_root_backup_key).as_str())?;
        }
        if !self.current_app_version.is_empty() {
            struct_ser.serialize_field("currentAppVersion", &self.current_app_version)?;
        }
        if !self.first_app_version.is_empty() {
            struct_ser.serialize_field("firstAppVersion", &self.first_app_version)?;
        }
        if !self.debug_info.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("debugInfo", pbjson::private::base64::encode(&self.debug_info).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for BackupInfo {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "version",
            "backupTimeMs",
            "mediaRootBackupKey",
            "currentAppVersion",
            "firstAppVersion",
            "debugInfo",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Version,
            BackupTimeMs,
            MediaRootBackupKey,
            CurrentAppVersion,
            FirstAppVersion,
            DebugInfo,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "version" => Ok(GeneratedField::Version),
                            "backupTimeMs" => Ok(GeneratedField::BackupTimeMs),
                            "mediaRootBackupKey" => Ok(GeneratedField::MediaRootBackupKey),
                            "currentAppVersion" => Ok(GeneratedField::CurrentAppVersion),
                            "firstAppVersion" => Ok(GeneratedField::FirstAppVersion),
                            "debugInfo" => Ok(GeneratedField::DebugInfo),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = BackupInfo;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.BackupInfo")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<BackupInfo, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut version__ = None;
                let mut backup_time_ms__ = None;
                let mut media_root_backup_key__ = None;
                let mut current_app_version__ = None;
                let mut first_app_version__ = None;
                let mut debug_info__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Version => {
                            if version__.is_some() {
                                return Err(serde::de::Error::duplicate_field("version"));
                            }
                            version__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::BackupTimeMs => {
                            if backup_time_ms__.is_some() {
                                return Err(serde::de::Error::duplicate_field("backupTimeMs"));
                            }
                            backup_time_ms__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::MediaRootBackupKey => {
                            if media_root_backup_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("mediaRootBackupKey"));
                            }
                            media_root_backup_key__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::CurrentAppVersion => {
                            if current_app_version__.is_some() {
                                return Err(serde::de::Error::duplicate_field("currentAppVersion"));
                            }
                            current_app_version__ = Some(map_.next_value()?);
                        }
                        GeneratedField::FirstAppVersion => {
                            if first_app_version__.is_some() {
                                return Err(serde::de::Error::duplicate_field("firstAppVersion"));
                            }
                            first_app_version__ = Some(map_.next_value()?);
                        }
                        GeneratedField::DebugInfo => {
                            if debug_info__.is_some() {
                                return Err(serde::de::Error::duplicate_field("debugInfo"));
                            }
                            debug_info__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(BackupInfo {
                    version: version__.unwrap_or_default(),
                    backup_time_ms: backup_time_ms__.unwrap_or_default(),
                    media_root_backup_key: media_root_backup_key__.unwrap_or_default(),
                    current_app_version: current_app_version__.unwrap_or_default(),
                    first_app_version: first_app_version__.unwrap_or_default(),
                    debug_info: debug_info__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.BackupInfo", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for BodyRange {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.start != 0 {
            len += 1;
        }
        if self.length != 0 {
            len += 1;
        }
        if self.associated_value.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.BodyRange", len)?;
        if self.start != 0 {
            struct_ser.serialize_field("start", &self.start)?;
        }
        if self.length != 0 {
            struct_ser.serialize_field("length", &self.length)?;
        }
        if let Some(v) = self.associated_value.as_ref() {
            match v {
                body_range::AssociatedValue::MentionAci(v) => {
                    #[allow(clippy::needless_borrow)]
                    #[allow(clippy::needless_borrows_for_generic_args)]
                    struct_ser.serialize_field("mentionAci", pbjson::private::base64::encode(&v).as_str())?;
                }
                body_range::AssociatedValue::Style(v) => {
                    let v = body_range::Style::try_from(*v)
                        .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?;
                    struct_ser.serialize_field("style", &v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for BodyRange {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "start",
            "length",
            "mentionAci",
            "style",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Start,
            Length,
            MentionAci,
            Style,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "start" => Ok(GeneratedField::Start),
                            "length" => Ok(GeneratedField::Length),
                            "mentionAci" => Ok(GeneratedField::MentionAci),
                            "style" => Ok(GeneratedField::Style),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = BodyRange;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.BodyRange")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<BodyRange, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut start__ = None;
                let mut length__ = None;
                let mut associated_value__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Start => {
                            if start__.is_some() {
                                return Err(serde::de::Error::duplicate_field("start"));
                            }
                            start__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Length => {
                            if length__.is_some() {
                                return Err(serde::de::Error::duplicate_field("length"));
                            }
                            length__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::MentionAci => {
                            if associated_value__.is_some() {
                                return Err(serde::de::Error::duplicate_field("mentionAci"));
                            }
                            associated_value__ = map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| body_range::AssociatedValue::MentionAci(x.0));
                        }
                        GeneratedField::Style => {
                            if associated_value__.is_some() {
                                return Err(serde::de::Error::duplicate_field("style"));
                            }
                            associated_value__ = map_.next_value::<::std::option::Option<body_range::Style>>()?.map(|x| body_range::AssociatedValue::Style(x as i32));
                        }
                    }
                }
                Ok(BodyRange {
                    start: start__.unwrap_or_default(),
                    length: length__.unwrap_or_default(),
                    associated_value: associated_value__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.BodyRange", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for body_range::Style {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::None => "NONE",
            Self::Bold => "BOLD",
            Self::Italic => "ITALIC",
            Self::Spoiler => "SPOILER",
            Self::Strikethrough => "STRIKETHROUGH",
            Self::Monospace => "MONOSPACE",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for body_range::Style {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "NONE",
            "BOLD",
            "ITALIC",
            "SPOILER",
            "STRIKETHROUGH",
            "MONOSPACE",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = body_range::Style;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "NONE" => Ok(body_range::Style::None),
                    "BOLD" => Ok(body_range::Style::Bold),
                    "ITALIC" => Ok(body_range::Style::Italic),
                    "SPOILER" => Ok(body_range::Style::Spoiler),
                    "STRIKETHROUGH" => Ok(body_range::Style::Strikethrough),
                    "MONOSPACE" => Ok(body_range::Style::Monospace),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for CallLink {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.root_key.is_empty() {
            len += 1;
        }
        if self.admin_key.is_some() {
            len += 1;
        }
        if !self.name.is_empty() {
            len += 1;
        }
        if self.restrictions != 0 {
            len += 1;
        }
        if self.expiration_ms != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.CallLink", len)?;
        if !self.root_key.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("rootKey", pbjson::private::base64::encode(&self.root_key).as_str())?;
        }
        if let Some(v) = self.admin_key.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("adminKey", pbjson::private::base64::encode(&v).as_str())?;
        }
        if !self.name.is_empty() {
            struct_ser.serialize_field("name", &self.name)?;
        }
        if self.restrictions != 0 {
            let v = call_link::Restrictions::try_from(self.restrictions)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.restrictions)))?;
            struct_ser.serialize_field("restrictions", &v)?;
        }
        if self.expiration_ms != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("expirationMs", ToString::to_string(&self.expiration_ms).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for CallLink {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "rootKey",
            "adminKey",
            "name",
            "restrictions",
            "expirationMs",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            RootKey,
            AdminKey,
            Name,
            Restrictions,
            ExpirationMs,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "rootKey" => Ok(GeneratedField::RootKey),
                            "adminKey" => Ok(GeneratedField::AdminKey),
                            "name" => Ok(GeneratedField::Name),
                            "restrictions" => Ok(GeneratedField::Restrictions),
                            "expirationMs" => Ok(GeneratedField::ExpirationMs),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = CallLink;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.CallLink")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<CallLink, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut root_key__ = None;
                let mut admin_key__ = None;
                let mut name__ = None;
                let mut restrictions__ = None;
                let mut expiration_ms__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::RootKey => {
                            if root_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("rootKey"));
                            }
                            root_key__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::AdminKey => {
                            if admin_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("adminKey"));
                            }
                            admin_key__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Name => {
                            if name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("name"));
                            }
                            name__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Restrictions => {
                            if restrictions__.is_some() {
                                return Err(serde::de::Error::duplicate_field("restrictions"));
                            }
                            restrictions__ = Some(map_.next_value::<call_link::Restrictions>()? as i32);
                        }
                        GeneratedField::ExpirationMs => {
                            if expiration_ms__.is_some() {
                                return Err(serde::de::Error::duplicate_field("expirationMs"));
                            }
                            expiration_ms__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(CallLink {
                    root_key: root_key__.unwrap_or_default(),
                    admin_key: admin_key__,
                    name: name__.unwrap_or_default(),
                    restrictions: restrictions__.unwrap_or_default(),
                    expiration_ms: expiration_ms__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.CallLink", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for call_link::Restrictions {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::None => "NONE",
            Self::AdminApproval => "ADMIN_APPROVAL",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for call_link::Restrictions {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "NONE",
            "ADMIN_APPROVAL",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = call_link::Restrictions;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(call_link::Restrictions::Unknown),
                    "NONE" => Ok(call_link::Restrictions::None),
                    "ADMIN_APPROVAL" => Ok(call_link::Restrictions::AdminApproval),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for Chat {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.id != 0 {
            len += 1;
        }
        if self.recipient_id != 0 {
            len += 1;
        }
        if self.archived {
            len += 1;
        }
        if self.pinned_order.is_some() {
            len += 1;
        }
        if self.expiration_timer_ms.is_some() {
            len += 1;
        }
        if self.mute_until_ms.is_some() {
            len += 1;
        }
        if self.marked_unread {
            len += 1;
        }
        if self.dont_notify_for_mentions_if_muted {
            len += 1;
        }
        if self.style.is_some() {
            len += 1;
        }
        if self.expire_timer_version != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Chat", len)?;
        if self.id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?;
        }
        if self.recipient_id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("recipientId", ToString::to_string(&self.recipient_id).as_str())?;
        }
        if self.archived {
            struct_ser.serialize_field("archived", &self.archived)?;
        }
        if let Some(v) = self.pinned_order.as_ref() {
            struct_ser.serialize_field("pinnedOrder", v)?;
        }
        if let Some(v) = self.expiration_timer_ms.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("expirationTimerMs", ToString::to_string(&v).as_str())?;
        }
        if let Some(v) = self.mute_until_ms.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("muteUntilMs", ToString::to_string(&v).as_str())?;
        }
        if self.marked_unread {
            struct_ser.serialize_field("markedUnread", &self.marked_unread)?;
        }
        if self.dont_notify_for_mentions_if_muted {
            struct_ser.serialize_field("dontNotifyForMentionsIfMuted", &self.dont_notify_for_mentions_if_muted)?;
        }
        if let Some(v) = self.style.as_ref() {
            struct_ser.serialize_field("style", v)?;
        }
        if self.expire_timer_version != 0 {
            struct_ser.serialize_field("expireTimerVersion", &self.expire_timer_version)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for Chat {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "id",
            "recipientId",
            "archived",
            "pinnedOrder",
            "expirationTimerMs",
            "muteUntilMs",
            "markedUnread",
            "dontNotifyForMentionsIfMuted",
            "style",
            "expireTimerVersion",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Id,
            RecipientId,
            Archived,
            PinnedOrder,
            ExpirationTimerMs,
            MuteUntilMs,
            MarkedUnread,
            DontNotifyForMentionsIfMuted,
            Style,
            ExpireTimerVersion,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "id" => Ok(GeneratedField::Id),
                            "recipientId" => Ok(GeneratedField::RecipientId),
                            "archived" => Ok(GeneratedField::Archived),
                            "pinnedOrder" => Ok(GeneratedField::PinnedOrder),
                            "expirationTimerMs" => Ok(GeneratedField::ExpirationTimerMs),
                            "muteUntilMs" => Ok(GeneratedField::MuteUntilMs),
                            "markedUnread" => Ok(GeneratedField::MarkedUnread),
                            "dontNotifyForMentionsIfMuted" => Ok(GeneratedField::DontNotifyForMentionsIfMuted),
                            "style" => Ok(GeneratedField::Style),
                            "expireTimerVersion" => Ok(GeneratedField::ExpireTimerVersion),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = Chat;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Chat")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Chat, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut id__ = None;
                let mut recipient_id__ = None;
                let mut archived__ = None;
                let mut pinned_order__ = None;
                let mut expiration_timer_ms__ = None;
                let mut mute_until_ms__ = None;
                let mut marked_unread__ = None;
                let mut dont_notify_for_mentions_if_muted__ = None;
                let mut style__ = None;
                let mut expire_timer_version__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Id => {
                            if id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("id"));
                            }
                            id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::RecipientId => {
                            if recipient_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("recipientId"));
                            }
                            recipient_id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Archived => {
                            if archived__.is_some() {
                                return Err(serde::de::Error::duplicate_field("archived"));
                            }
                            archived__ = Some(map_.next_value()?);
                        }
                        GeneratedField::PinnedOrder => {
                            if pinned_order__.is_some() {
                                return Err(serde::de::Error::duplicate_field("pinnedOrder"));
                            }
                            pinned_order__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::ExpirationTimerMs => {
                            if expiration_timer_ms__.is_some() {
                                return Err(serde::de::Error::duplicate_field("expirationTimerMs"));
                            }
                            expiration_timer_ms__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::MuteUntilMs => {
                            if mute_until_ms__.is_some() {
                                return Err(serde::de::Error::duplicate_field("muteUntilMs"));
                            }
                            mute_until_ms__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::MarkedUnread => {
                            if marked_unread__.is_some() {
                                return Err(serde::de::Error::duplicate_field("markedUnread"));
                            }
                            marked_unread__ = Some(map_.next_value()?);
                        }
                        GeneratedField::DontNotifyForMentionsIfMuted => {
                            if dont_notify_for_mentions_if_muted__.is_some() {
                                return Err(serde::de::Error::duplicate_field("dontNotifyForMentionsIfMuted"));
                            }
                            dont_notify_for_mentions_if_muted__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Style => {
                            if style__.is_some() {
                                return Err(serde::de::Error::duplicate_field("style"));
                            }
                            style__ = map_.next_value()?;
                        }
                        GeneratedField::ExpireTimerVersion => {
                            if expire_timer_version__.is_some() {
                                return Err(serde::de::Error::duplicate_field("expireTimerVersion"));
                            }
                            expire_timer_version__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(Chat {
                    id: id__.unwrap_or_default(),
                    recipient_id: recipient_id__.unwrap_or_default(),
                    archived: archived__.unwrap_or_default(),
                    pinned_order: pinned_order__,
                    expiration_timer_ms: expiration_timer_ms__,
                    mute_until_ms: mute_until_ms__,
                    marked_unread: marked_unread__.unwrap_or_default(),
                    dont_notify_for_mentions_if_muted: dont_notify_for_mentions_if_muted__.unwrap_or_default(),
                    style: style__,
                    expire_timer_version: expire_timer_version__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Chat", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for ChatFolder {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.name.is_empty() {
            len += 1;
        }
        if self.show_only_unread {
            len += 1;
        }
        if self.show_muted_chats {
            len += 1;
        }
        if self.include_all_individual_chats {
            len += 1;
        }
        if self.include_all_group_chats {
            len += 1;
        }
        if self.folder_type != 0 {
            len += 1;
        }
        if !self.included_recipient_ids.is_empty() {
            len += 1;
        }
        if !self.excluded_recipient_ids.is_empty() {
            len += 1;
        }
        if !self.id.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ChatFolder", len)?;
        if !self.name.is_empty() {
            struct_ser.serialize_field("name", &self.name)?;
        }
        if self.show_only_unread {
            struct_ser.serialize_field("showOnlyUnread", &self.show_only_unread)?;
        }
        if self.show_muted_chats {
            struct_ser.serialize_field("showMutedChats", &self.show_muted_chats)?;
        }
        if self.include_all_individual_chats {
            struct_ser.serialize_field("includeAllIndividualChats", &self.include_all_individual_chats)?;
        }
        if self.include_all_group_chats {
            struct_ser.serialize_field("includeAllGroupChats", &self.include_all_group_chats)?;
        }
        if self.folder_type != 0 {
            let v = chat_folder::FolderType::try_from(self.folder_type)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.folder_type)))?;
            struct_ser.serialize_field("folderType", &v)?;
        }
        if !self.included_recipient_ids.is_empty() {
            struct_ser.serialize_field("includedRecipientIds", &self.included_recipient_ids.iter().map(ToString::to_string).collect::<Vec<_>>())?;
        }
        if !self.excluded_recipient_ids.is_empty() {
            struct_ser.serialize_field("excludedRecipientIds", &self.excluded_recipient_ids.iter().map(ToString::to_string).collect::<Vec<_>>())?;
        }
        if !self.id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("id", pbjson::private::base64::encode(&self.id).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ChatFolder {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "name",
            "showOnlyUnread",
            "showMutedChats",
            "includeAllIndividualChats",
            "includeAllGroupChats",
            "folderType",
            "includedRecipientIds",
            "excludedRecipientIds",
            "id",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Name,
            ShowOnlyUnread,
            ShowMutedChats,
            IncludeAllIndividualChats,
            IncludeAllGroupChats,
            FolderType,
            IncludedRecipientIds,
            ExcludedRecipientIds,
            Id,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "name" => Ok(GeneratedField::Name),
                            "showOnlyUnread" => Ok(GeneratedField::ShowOnlyUnread),
                            "showMutedChats" => Ok(GeneratedField::ShowMutedChats),
                            "includeAllIndividualChats" => Ok(GeneratedField::IncludeAllIndividualChats),
                            "includeAllGroupChats" => Ok(GeneratedField::IncludeAllGroupChats),
                            "folderType" => Ok(GeneratedField::FolderType),
                            "includedRecipientIds" => Ok(GeneratedField::IncludedRecipientIds),
                            "excludedRecipientIds" => Ok(GeneratedField::ExcludedRecipientIds),
                            "id" => Ok(GeneratedField::Id),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ChatFolder;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ChatFolder")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ChatFolder, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut name__ = None;
                let mut show_only_unread__ = None;
                let mut show_muted_chats__ = None;
                let mut include_all_individual_chats__ = None;
                let mut include_all_group_chats__ = None;
                let mut folder_type__ = None;
                let mut included_recipient_ids__ = None;
                let mut excluded_recipient_ids__ = None;
                let mut id__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Name => {
                            if name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("name"));
                            }
                            name__ = Some(map_.next_value()?);
                        }
                        GeneratedField::ShowOnlyUnread => {
                            if show_only_unread__.is_some() {
                                return Err(serde::de::Error::duplicate_field("showOnlyUnread"));
                            }
                            show_only_unread__ = Some(map_.next_value()?);
                        }
                        GeneratedField::ShowMutedChats => {
                            if show_muted_chats__.is_some() {
                                return Err(serde::de::Error::duplicate_field("showMutedChats"));
                            }
                            show_muted_chats__ = Some(map_.next_value()?);
                        }
                        GeneratedField::IncludeAllIndividualChats => {
                            if include_all_individual_chats__.is_some() {
                                return Err(serde::de::Error::duplicate_field("includeAllIndividualChats"));
                            }
                            include_all_individual_chats__ = Some(map_.next_value()?);
                        }
                        GeneratedField::IncludeAllGroupChats => {
                            if include_all_group_chats__.is_some() {
                                return Err(serde::de::Error::duplicate_field("includeAllGroupChats"));
                            }
                            include_all_group_chats__ = Some(map_.next_value()?);
                        }
                        GeneratedField::FolderType => {
                            if folder_type__.is_some() {
                                return Err(serde::de::Error::duplicate_field("folderType"));
                            }
                            folder_type__ = Some(map_.next_value::<chat_folder::FolderType>()? as i32);
                        }
                        GeneratedField::IncludedRecipientIds => {
                            if included_recipient_ids__.is_some() {
                                return Err(serde::de::Error::duplicate_field("includedRecipientIds"));
                            }
                            included_recipient_ids__ = 
                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
                                    .into_iter().map(|x| x.0).collect())
                            ;
                        }
                        GeneratedField::ExcludedRecipientIds => {
                            if excluded_recipient_ids__.is_some() {
                                return Err(serde::de::Error::duplicate_field("excludedRecipientIds"));
                            }
                            excluded_recipient_ids__ = 
                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
                                    .into_iter().map(|x| x.0).collect())
                            ;
                        }
                        GeneratedField::Id => {
                            if id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("id"));
                            }
                            id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(ChatFolder {
                    name: name__.unwrap_or_default(),
                    show_only_unread: show_only_unread__.unwrap_or_default(),
                    show_muted_chats: show_muted_chats__.unwrap_or_default(),
                    include_all_individual_chats: include_all_individual_chats__.unwrap_or_default(),
                    include_all_group_chats: include_all_group_chats__.unwrap_or_default(),
                    folder_type: folder_type__.unwrap_or_default(),
                    included_recipient_ids: included_recipient_ids__.unwrap_or_default(),
                    excluded_recipient_ids: excluded_recipient_ids__.unwrap_or_default(),
                    id: id__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ChatFolder", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for chat_folder::FolderType {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::All => "ALL",
            Self::Custom => "CUSTOM",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for chat_folder::FolderType {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "ALL",
            "CUSTOM",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = chat_folder::FolderType;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(chat_folder::FolderType::Unknown),
                    "ALL" => Ok(chat_folder::FolderType::All),
                    "CUSTOM" => Ok(chat_folder::FolderType::Custom),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for ChatItem {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.chat_id != 0 {
            len += 1;
        }
        if self.author_id != 0 {
            len += 1;
        }
        if self.date_sent != 0 {
            len += 1;
        }
        if self.expire_start_date.is_some() {
            len += 1;
        }
        if self.expires_in_ms.is_some() {
            len += 1;
        }
        if !self.revisions.is_empty() {
            len += 1;
        }
        if self.sms {
            len += 1;
        }
        if self.pin_details.is_some() {
            len += 1;
        }
        if self.directional_details.is_some() {
            len += 1;
        }
        if self.item.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ChatItem", len)?;
        if self.chat_id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("chatId", ToString::to_string(&self.chat_id).as_str())?;
        }
        if self.author_id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("authorId", ToString::to_string(&self.author_id).as_str())?;
        }
        if self.date_sent != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("dateSent", ToString::to_string(&self.date_sent).as_str())?;
        }
        if let Some(v) = self.expire_start_date.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("expireStartDate", ToString::to_string(&v).as_str())?;
        }
        if let Some(v) = self.expires_in_ms.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("expiresInMs", ToString::to_string(&v).as_str())?;
        }
        if !self.revisions.is_empty() {
            struct_ser.serialize_field("revisions", &self.revisions)?;
        }
        if self.sms {
            struct_ser.serialize_field("sms", &self.sms)?;
        }
        if let Some(v) = self.pin_details.as_ref() {
            struct_ser.serialize_field("pinDetails", v)?;
        }
        if let Some(v) = self.directional_details.as_ref() {
            match v {
                chat_item::DirectionalDetails::Incoming(v) => {
                    struct_ser.serialize_field("incoming", v)?;
                }
                chat_item::DirectionalDetails::Outgoing(v) => {
                    struct_ser.serialize_field("outgoing", v)?;
                }
                chat_item::DirectionalDetails::Directionless(v) => {
                    struct_ser.serialize_field("directionless", v)?;
                }
            }
        }
        if let Some(v) = self.item.as_ref() {
            match v {
                chat_item::Item::StandardMessage(v) => {
                    struct_ser.serialize_field("standardMessage", v)?;
                }
                chat_item::Item::ContactMessage(v) => {
                    struct_ser.serialize_field("contactMessage", v)?;
                }
                chat_item::Item::StickerMessage(v) => {
                    struct_ser.serialize_field("stickerMessage", v)?;
                }
                chat_item::Item::RemoteDeletedMessage(v) => {
                    struct_ser.serialize_field("remoteDeletedMessage", v)?;
                }
                chat_item::Item::UpdateMessage(v) => {
                    struct_ser.serialize_field("updateMessage", v)?;
                }
                chat_item::Item::PaymentNotification(v) => {
                    struct_ser.serialize_field("paymentNotification", v)?;
                }
                chat_item::Item::GiftBadge(v) => {
                    struct_ser.serialize_field("giftBadge", v)?;
                }
                chat_item::Item::ViewOnceMessage(v) => {
                    struct_ser.serialize_field("viewOnceMessage", v)?;
                }
                chat_item::Item::DirectStoryReplyMessage(v) => {
                    struct_ser.serialize_field("directStoryReplyMessage", v)?;
                }
                chat_item::Item::Poll(v) => {
                    struct_ser.serialize_field("poll", v)?;
                }
                chat_item::Item::AdminDeletedMessage(v) => {
                    struct_ser.serialize_field("adminDeletedMessage", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ChatItem {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "chatId",
            "authorId",
            "dateSent",
            "expireStartDate",
            "expiresInMs",
            "revisions",
            "sms",
            "pinDetails",
            "incoming",
            "outgoing",
            "directionless",
            "standardMessage",
            "contactMessage",
            "stickerMessage",
            "remoteDeletedMessage",
            "updateMessage",
            "paymentNotification",
            "giftBadge",
            "viewOnceMessage",
            "directStoryReplyMessage",
            "poll",
            "adminDeletedMessage",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            ChatId,
            AuthorId,
            DateSent,
            ExpireStartDate,
            ExpiresInMs,
            Revisions,
            Sms,
            PinDetails,
            Incoming,
            Outgoing,
            Directionless,
            StandardMessage,
            ContactMessage,
            StickerMessage,
            RemoteDeletedMessage,
            UpdateMessage,
            PaymentNotification,
            GiftBadge,
            ViewOnceMessage,
            DirectStoryReplyMessage,
            Poll,
            AdminDeletedMessage,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "chatId" => Ok(GeneratedField::ChatId),
                            "authorId" => Ok(GeneratedField::AuthorId),
                            "dateSent" => Ok(GeneratedField::DateSent),
                            "expireStartDate" => Ok(GeneratedField::ExpireStartDate),
                            "expiresInMs" => Ok(GeneratedField::ExpiresInMs),
                            "revisions" => Ok(GeneratedField::Revisions),
                            "sms" => Ok(GeneratedField::Sms),
                            "pinDetails" => Ok(GeneratedField::PinDetails),
                            "incoming" => Ok(GeneratedField::Incoming),
                            "outgoing" => Ok(GeneratedField::Outgoing),
                            "directionless" => Ok(GeneratedField::Directionless),
                            "standardMessage" => Ok(GeneratedField::StandardMessage),
                            "contactMessage" => Ok(GeneratedField::ContactMessage),
                            "stickerMessage" => Ok(GeneratedField::StickerMessage),
                            "remoteDeletedMessage" => Ok(GeneratedField::RemoteDeletedMessage),
                            "updateMessage" => Ok(GeneratedField::UpdateMessage),
                            "paymentNotification" => Ok(GeneratedField::PaymentNotification),
                            "giftBadge" => Ok(GeneratedField::GiftBadge),
                            "viewOnceMessage" => Ok(GeneratedField::ViewOnceMessage),
                            "directStoryReplyMessage" => Ok(GeneratedField::DirectStoryReplyMessage),
                            "poll" => Ok(GeneratedField::Poll),
                            "adminDeletedMessage" => Ok(GeneratedField::AdminDeletedMessage),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ChatItem;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ChatItem")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ChatItem, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut chat_id__ = None;
                let mut author_id__ = None;
                let mut date_sent__ = None;
                let mut expire_start_date__ = None;
                let mut expires_in_ms__ = None;
                let mut revisions__ = None;
                let mut sms__ = None;
                let mut pin_details__ = None;
                let mut directional_details__ = None;
                let mut item__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::ChatId => {
                            if chat_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("chatId"));
                            }
                            chat_id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::AuthorId => {
                            if author_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("authorId"));
                            }
                            author_id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::DateSent => {
                            if date_sent__.is_some() {
                                return Err(serde::de::Error::duplicate_field("dateSent"));
                            }
                            date_sent__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::ExpireStartDate => {
                            if expire_start_date__.is_some() {
                                return Err(serde::de::Error::duplicate_field("expireStartDate"));
                            }
                            expire_start_date__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::ExpiresInMs => {
                            if expires_in_ms__.is_some() {
                                return Err(serde::de::Error::duplicate_field("expiresInMs"));
                            }
                            expires_in_ms__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Revisions => {
                            if revisions__.is_some() {
                                return Err(serde::de::Error::duplicate_field("revisions"));
                            }
                            revisions__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Sms => {
                            if sms__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sms"));
                            }
                            sms__ = Some(map_.next_value()?);
                        }
                        GeneratedField::PinDetails => {
                            if pin_details__.is_some() {
                                return Err(serde::de::Error::duplicate_field("pinDetails"));
                            }
                            pin_details__ = map_.next_value()?;
                        }
                        GeneratedField::Incoming => {
                            if directional_details__.is_some() {
                                return Err(serde::de::Error::duplicate_field("incoming"));
                            }
                            directional_details__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::DirectionalDetails::Incoming)
;
                        }
                        GeneratedField::Outgoing => {
                            if directional_details__.is_some() {
                                return Err(serde::de::Error::duplicate_field("outgoing"));
                            }
                            directional_details__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::DirectionalDetails::Outgoing)
;
                        }
                        GeneratedField::Directionless => {
                            if directional_details__.is_some() {
                                return Err(serde::de::Error::duplicate_field("directionless"));
                            }
                            directional_details__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::DirectionalDetails::Directionless)
;
                        }
                        GeneratedField::StandardMessage => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("standardMessage"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::Item::StandardMessage)
;
                        }
                        GeneratedField::ContactMessage => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("contactMessage"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::Item::ContactMessage)
;
                        }
                        GeneratedField::StickerMessage => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("stickerMessage"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::Item::StickerMessage)
;
                        }
                        GeneratedField::RemoteDeletedMessage => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("remoteDeletedMessage"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::Item::RemoteDeletedMessage)
;
                        }
                        GeneratedField::UpdateMessage => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updateMessage"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::Item::UpdateMessage)
;
                        }
                        GeneratedField::PaymentNotification => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("paymentNotification"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::Item::PaymentNotification)
;
                        }
                        GeneratedField::GiftBadge => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("giftBadge"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::Item::GiftBadge)
;
                        }
                        GeneratedField::ViewOnceMessage => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("viewOnceMessage"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::Item::ViewOnceMessage)
;
                        }
                        GeneratedField::DirectStoryReplyMessage => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("directStoryReplyMessage"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::Item::DirectStoryReplyMessage)
;
                        }
                        GeneratedField::Poll => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("poll"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::Item::Poll)
;
                        }
                        GeneratedField::AdminDeletedMessage => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("adminDeletedMessage"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::Item::AdminDeletedMessage)
;
                        }
                    }
                }
                Ok(ChatItem {
                    chat_id: chat_id__.unwrap_or_default(),
                    author_id: author_id__.unwrap_or_default(),
                    date_sent: date_sent__.unwrap_or_default(),
                    expire_start_date: expire_start_date__,
                    expires_in_ms: expires_in_ms__,
                    revisions: revisions__.unwrap_or_default(),
                    sms: sms__.unwrap_or_default(),
                    pin_details: pin_details__,
                    directional_details: directional_details__,
                    item: item__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ChatItem", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for chat_item::DirectionlessMessageDetails {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let len = 0;
        let struct_ser = serializer.serialize_struct("signal.backup.ChatItem.DirectionlessMessageDetails", len)?;
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for chat_item::DirectionlessMessageDetails {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                            Err(serde::de::Error::unknown_field(value, FIELDS))
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = chat_item::DirectionlessMessageDetails;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ChatItem.DirectionlessMessageDetails")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<chat_item::DirectionlessMessageDetails, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                while map_.next_key::<GeneratedField>()?.is_some() {
                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
                }
                Ok(chat_item::DirectionlessMessageDetails {
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ChatItem.DirectionlessMessageDetails", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for chat_item::IncomingMessageDetails {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.date_received != 0 {
            len += 1;
        }
        if self.date_server_sent.is_some() {
            len += 1;
        }
        if self.read {
            len += 1;
        }
        if self.sealed_sender {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ChatItem.IncomingMessageDetails", len)?;
        if self.date_received != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("dateReceived", ToString::to_string(&self.date_received).as_str())?;
        }
        if let Some(v) = self.date_server_sent.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("dateServerSent", ToString::to_string(&v).as_str())?;
        }
        if self.read {
            struct_ser.serialize_field("read", &self.read)?;
        }
        if self.sealed_sender {
            struct_ser.serialize_field("sealedSender", &self.sealed_sender)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for chat_item::IncomingMessageDetails {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "dateReceived",
            "dateServerSent",
            "read",
            "sealedSender",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            DateReceived,
            DateServerSent,
            Read,
            SealedSender,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "dateReceived" => Ok(GeneratedField::DateReceived),
                            "dateServerSent" => Ok(GeneratedField::DateServerSent),
                            "read" => Ok(GeneratedField::Read),
                            "sealedSender" => Ok(GeneratedField::SealedSender),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = chat_item::IncomingMessageDetails;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ChatItem.IncomingMessageDetails")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<chat_item::IncomingMessageDetails, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut date_received__ = None;
                let mut date_server_sent__ = None;
                let mut read__ = None;
                let mut sealed_sender__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::DateReceived => {
                            if date_received__.is_some() {
                                return Err(serde::de::Error::duplicate_field("dateReceived"));
                            }
                            date_received__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::DateServerSent => {
                            if date_server_sent__.is_some() {
                                return Err(serde::de::Error::duplicate_field("dateServerSent"));
                            }
                            date_server_sent__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Read => {
                            if read__.is_some() {
                                return Err(serde::de::Error::duplicate_field("read"));
                            }
                            read__ = Some(map_.next_value()?);
                        }
                        GeneratedField::SealedSender => {
                            if sealed_sender__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sealedSender"));
                            }
                            sealed_sender__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(chat_item::IncomingMessageDetails {
                    date_received: date_received__.unwrap_or_default(),
                    date_server_sent: date_server_sent__,
                    read: read__.unwrap_or_default(),
                    sealed_sender: sealed_sender__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ChatItem.IncomingMessageDetails", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for chat_item::OutgoingMessageDetails {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.send_status.is_empty() {
            len += 1;
        }
        if self.date_received != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ChatItem.OutgoingMessageDetails", len)?;
        if !self.send_status.is_empty() {
            struct_ser.serialize_field("sendStatus", &self.send_status)?;
        }
        if self.date_received != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("dateReceived", ToString::to_string(&self.date_received).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for chat_item::OutgoingMessageDetails {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "sendStatus",
            "dateReceived",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            SendStatus,
            DateReceived,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "sendStatus" => Ok(GeneratedField::SendStatus),
                            "dateReceived" => Ok(GeneratedField::DateReceived),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = chat_item::OutgoingMessageDetails;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ChatItem.OutgoingMessageDetails")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<chat_item::OutgoingMessageDetails, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut send_status__ = None;
                let mut date_received__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::SendStatus => {
                            if send_status__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sendStatus"));
                            }
                            send_status__ = Some(map_.next_value()?);
                        }
                        GeneratedField::DateReceived => {
                            if date_received__.is_some() {
                                return Err(serde::de::Error::duplicate_field("dateReceived"));
                            }
                            date_received__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(chat_item::OutgoingMessageDetails {
                    send_status: send_status__.unwrap_or_default(),
                    date_received: date_received__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ChatItem.OutgoingMessageDetails", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for chat_item::PinDetails {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.pinned_at_timestamp != 0 {
            len += 1;
        }
        if self.pin_expiry.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ChatItem.PinDetails", len)?;
        if self.pinned_at_timestamp != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("pinnedAtTimestamp", ToString::to_string(&self.pinned_at_timestamp).as_str())?;
        }
        if let Some(v) = self.pin_expiry.as_ref() {
            match v {
                chat_item::pin_details::PinExpiry::PinExpiresAtTimestamp(v) => {
                    #[allow(clippy::needless_borrow)]
                    #[allow(clippy::needless_borrows_for_generic_args)]
                    struct_ser.serialize_field("pinExpiresAtTimestamp", ToString::to_string(&v).as_str())?;
                }
                chat_item::pin_details::PinExpiry::PinNeverExpires(v) => {
                    struct_ser.serialize_field("pinNeverExpires", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for chat_item::PinDetails {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "pinnedAtTimestamp",
            "pinExpiresAtTimestamp",
            "pinNeverExpires",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            PinnedAtTimestamp,
            PinExpiresAtTimestamp,
            PinNeverExpires,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "pinnedAtTimestamp" => Ok(GeneratedField::PinnedAtTimestamp),
                            "pinExpiresAtTimestamp" => Ok(GeneratedField::PinExpiresAtTimestamp),
                            "pinNeverExpires" => Ok(GeneratedField::PinNeverExpires),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = chat_item::PinDetails;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ChatItem.PinDetails")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<chat_item::PinDetails, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut pinned_at_timestamp__ = None;
                let mut pin_expiry__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::PinnedAtTimestamp => {
                            if pinned_at_timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("pinnedAtTimestamp"));
                            }
                            pinned_at_timestamp__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::PinExpiresAtTimestamp => {
                            if pin_expiry__.is_some() {
                                return Err(serde::de::Error::duplicate_field("pinExpiresAtTimestamp"));
                            }
                            pin_expiry__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| chat_item::pin_details::PinExpiry::PinExpiresAtTimestamp(x.0));
                        }
                        GeneratedField::PinNeverExpires => {
                            if pin_expiry__.is_some() {
                                return Err(serde::de::Error::duplicate_field("pinNeverExpires"));
                            }
                            pin_expiry__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_item::pin_details::PinExpiry::PinNeverExpires);
                        }
                    }
                }
                Ok(chat_item::PinDetails {
                    pinned_at_timestamp: pinned_at_timestamp__.unwrap_or_default(),
                    pin_expiry: pin_expiry__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ChatItem.PinDetails", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for ChatStyle {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.dim_wallpaper_in_dark_mode {
            len += 1;
        }
        if self.wallpaper.is_some() {
            len += 1;
        }
        if self.bubble_color.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ChatStyle", len)?;
        if self.dim_wallpaper_in_dark_mode {
            struct_ser.serialize_field("dimWallpaperInDarkMode", &self.dim_wallpaper_in_dark_mode)?;
        }
        if let Some(v) = self.wallpaper.as_ref() {
            match v {
                chat_style::Wallpaper::WallpaperPreset(v) => {
                    let v = chat_style::WallpaperPreset::try_from(*v)
                        .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?;
                    struct_ser.serialize_field("wallpaperPreset", &v)?;
                }
                chat_style::Wallpaper::WallpaperPhoto(v) => {
                    struct_ser.serialize_field("wallpaperPhoto", v)?;
                }
            }
        }
        if let Some(v) = self.bubble_color.as_ref() {
            match v {
                chat_style::BubbleColor::AutoBubbleColor(v) => {
                    struct_ser.serialize_field("autoBubbleColor", v)?;
                }
                chat_style::BubbleColor::BubbleColorPreset(v) => {
                    let v = chat_style::BubbleColorPreset::try_from(*v)
                        .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?;
                    struct_ser.serialize_field("bubbleColorPreset", &v)?;
                }
                chat_style::BubbleColor::CustomColorId(v) => {
                    #[allow(clippy::needless_borrow)]
                    #[allow(clippy::needless_borrows_for_generic_args)]
                    struct_ser.serialize_field("customColorId", ToString::to_string(&v).as_str())?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ChatStyle {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "dimWallpaperInDarkMode",
            "wallpaperPreset",
            "wallpaperPhoto",
            "autoBubbleColor",
            "bubbleColorPreset",
            "customColorId",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            DimWallpaperInDarkMode,
            WallpaperPreset,
            WallpaperPhoto,
            AutoBubbleColor,
            BubbleColorPreset,
            CustomColorId,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "dimWallpaperInDarkMode" => Ok(GeneratedField::DimWallpaperInDarkMode),
                            "wallpaperPreset" => Ok(GeneratedField::WallpaperPreset),
                            "wallpaperPhoto" => Ok(GeneratedField::WallpaperPhoto),
                            "autoBubbleColor" => Ok(GeneratedField::AutoBubbleColor),
                            "bubbleColorPreset" => Ok(GeneratedField::BubbleColorPreset),
                            "customColorId" => Ok(GeneratedField::CustomColorId),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ChatStyle;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ChatStyle")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ChatStyle, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut dim_wallpaper_in_dark_mode__ = None;
                let mut wallpaper__ = None;
                let mut bubble_color__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::DimWallpaperInDarkMode => {
                            if dim_wallpaper_in_dark_mode__.is_some() {
                                return Err(serde::de::Error::duplicate_field("dimWallpaperInDarkMode"));
                            }
                            dim_wallpaper_in_dark_mode__ = Some(map_.next_value()?);
                        }
                        GeneratedField::WallpaperPreset => {
                            if wallpaper__.is_some() {
                                return Err(serde::de::Error::duplicate_field("wallpaperPreset"));
                            }
                            wallpaper__ = map_.next_value::<::std::option::Option<chat_style::WallpaperPreset>>()?.map(|x| chat_style::Wallpaper::WallpaperPreset(x as i32));
                        }
                        GeneratedField::WallpaperPhoto => {
                            if wallpaper__.is_some() {
                                return Err(serde::de::Error::duplicate_field("wallpaperPhoto"));
                            }
                            wallpaper__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_style::Wallpaper::WallpaperPhoto)
;
                        }
                        GeneratedField::AutoBubbleColor => {
                            if bubble_color__.is_some() {
                                return Err(serde::de::Error::duplicate_field("autoBubbleColor"));
                            }
                            bubble_color__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_style::BubbleColor::AutoBubbleColor)
;
                        }
                        GeneratedField::BubbleColorPreset => {
                            if bubble_color__.is_some() {
                                return Err(serde::de::Error::duplicate_field("bubbleColorPreset"));
                            }
                            bubble_color__ = map_.next_value::<::std::option::Option<chat_style::BubbleColorPreset>>()?.map(|x| chat_style::BubbleColor::BubbleColorPreset(x as i32));
                        }
                        GeneratedField::CustomColorId => {
                            if bubble_color__.is_some() {
                                return Err(serde::de::Error::duplicate_field("customColorId"));
                            }
                            bubble_color__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| chat_style::BubbleColor::CustomColorId(x.0));
                        }
                    }
                }
                Ok(ChatStyle {
                    dim_wallpaper_in_dark_mode: dim_wallpaper_in_dark_mode__.unwrap_or_default(),
                    wallpaper: wallpaper__,
                    bubble_color: bubble_color__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ChatStyle", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for chat_style::AutomaticBubbleColor {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let len = 0;
        let struct_ser = serializer.serialize_struct("signal.backup.ChatStyle.AutomaticBubbleColor", len)?;
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for chat_style::AutomaticBubbleColor {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                            Err(serde::de::Error::unknown_field(value, FIELDS))
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = chat_style::AutomaticBubbleColor;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ChatStyle.AutomaticBubbleColor")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<chat_style::AutomaticBubbleColor, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                while map_.next_key::<GeneratedField>()?.is_some() {
                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
                }
                Ok(chat_style::AutomaticBubbleColor {
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ChatStyle.AutomaticBubbleColor", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for chat_style::BubbleColorPreset {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::UnknownBubbleColorPreset => "UNKNOWN_BUBBLE_COLOR_PRESET",
            Self::SolidUltramarine => "SOLID_ULTRAMARINE",
            Self::SolidCrimson => "SOLID_CRIMSON",
            Self::SolidVermilion => "SOLID_VERMILION",
            Self::SolidBurlap => "SOLID_BURLAP",
            Self::SolidForest => "SOLID_FOREST",
            Self::SolidWintergreen => "SOLID_WINTERGREEN",
            Self::SolidTeal => "SOLID_TEAL",
            Self::SolidBlue => "SOLID_BLUE",
            Self::SolidIndigo => "SOLID_INDIGO",
            Self::SolidViolet => "SOLID_VIOLET",
            Self::SolidPlum => "SOLID_PLUM",
            Self::SolidTaupe => "SOLID_TAUPE",
            Self::SolidSteel => "SOLID_STEEL",
            Self::GradientEmber => "GRADIENT_EMBER",
            Self::GradientMidnight => "GRADIENT_MIDNIGHT",
            Self::GradientInfrared => "GRADIENT_INFRARED",
            Self::GradientLagoon => "GRADIENT_LAGOON",
            Self::GradientFluorescent => "GRADIENT_FLUORESCENT",
            Self::GradientBasil => "GRADIENT_BASIL",
            Self::GradientSublime => "GRADIENT_SUBLIME",
            Self::GradientSea => "GRADIENT_SEA",
            Self::GradientTangerine => "GRADIENT_TANGERINE",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for chat_style::BubbleColorPreset {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN_BUBBLE_COLOR_PRESET",
            "SOLID_ULTRAMARINE",
            "SOLID_CRIMSON",
            "SOLID_VERMILION",
            "SOLID_BURLAP",
            "SOLID_FOREST",
            "SOLID_WINTERGREEN",
            "SOLID_TEAL",
            "SOLID_BLUE",
            "SOLID_INDIGO",
            "SOLID_VIOLET",
            "SOLID_PLUM",
            "SOLID_TAUPE",
            "SOLID_STEEL",
            "GRADIENT_EMBER",
            "GRADIENT_MIDNIGHT",
            "GRADIENT_INFRARED",
            "GRADIENT_LAGOON",
            "GRADIENT_FLUORESCENT",
            "GRADIENT_BASIL",
            "GRADIENT_SUBLIME",
            "GRADIENT_SEA",
            "GRADIENT_TANGERINE",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = chat_style::BubbleColorPreset;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN_BUBBLE_COLOR_PRESET" => Ok(chat_style::BubbleColorPreset::UnknownBubbleColorPreset),
                    "SOLID_ULTRAMARINE" => Ok(chat_style::BubbleColorPreset::SolidUltramarine),
                    "SOLID_CRIMSON" => Ok(chat_style::BubbleColorPreset::SolidCrimson),
                    "SOLID_VERMILION" => Ok(chat_style::BubbleColorPreset::SolidVermilion),
                    "SOLID_BURLAP" => Ok(chat_style::BubbleColorPreset::SolidBurlap),
                    "SOLID_FOREST" => Ok(chat_style::BubbleColorPreset::SolidForest),
                    "SOLID_WINTERGREEN" => Ok(chat_style::BubbleColorPreset::SolidWintergreen),
                    "SOLID_TEAL" => Ok(chat_style::BubbleColorPreset::SolidTeal),
                    "SOLID_BLUE" => Ok(chat_style::BubbleColorPreset::SolidBlue),
                    "SOLID_INDIGO" => Ok(chat_style::BubbleColorPreset::SolidIndigo),
                    "SOLID_VIOLET" => Ok(chat_style::BubbleColorPreset::SolidViolet),
                    "SOLID_PLUM" => Ok(chat_style::BubbleColorPreset::SolidPlum),
                    "SOLID_TAUPE" => Ok(chat_style::BubbleColorPreset::SolidTaupe),
                    "SOLID_STEEL" => Ok(chat_style::BubbleColorPreset::SolidSteel),
                    "GRADIENT_EMBER" => Ok(chat_style::BubbleColorPreset::GradientEmber),
                    "GRADIENT_MIDNIGHT" => Ok(chat_style::BubbleColorPreset::GradientMidnight),
                    "GRADIENT_INFRARED" => Ok(chat_style::BubbleColorPreset::GradientInfrared),
                    "GRADIENT_LAGOON" => Ok(chat_style::BubbleColorPreset::GradientLagoon),
                    "GRADIENT_FLUORESCENT" => Ok(chat_style::BubbleColorPreset::GradientFluorescent),
                    "GRADIENT_BASIL" => Ok(chat_style::BubbleColorPreset::GradientBasil),
                    "GRADIENT_SUBLIME" => Ok(chat_style::BubbleColorPreset::GradientSublime),
                    "GRADIENT_SEA" => Ok(chat_style::BubbleColorPreset::GradientSea),
                    "GRADIENT_TANGERINE" => Ok(chat_style::BubbleColorPreset::GradientTangerine),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for chat_style::CustomChatColor {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.id != 0 {
            len += 1;
        }
        if self.color.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ChatStyle.CustomChatColor", len)?;
        if self.id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?;
        }
        if let Some(v) = self.color.as_ref() {
            match v {
                chat_style::custom_chat_color::Color::Solid(v) => {
                    struct_ser.serialize_field("solid", v)?;
                }
                chat_style::custom_chat_color::Color::Gradient(v) => {
                    struct_ser.serialize_field("gradient", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for chat_style::CustomChatColor {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "id",
            "solid",
            "gradient",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Id,
            Solid,
            Gradient,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "id" => Ok(GeneratedField::Id),
                            "solid" => Ok(GeneratedField::Solid),
                            "gradient" => Ok(GeneratedField::Gradient),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = chat_style::CustomChatColor;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ChatStyle.CustomChatColor")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<chat_style::CustomChatColor, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut id__ = None;
                let mut color__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Id => {
                            if id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("id"));
                            }
                            id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Solid => {
                            if color__.is_some() {
                                return Err(serde::de::Error::duplicate_field("solid"));
                            }
                            color__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| chat_style::custom_chat_color::Color::Solid(x.0));
                        }
                        GeneratedField::Gradient => {
                            if color__.is_some() {
                                return Err(serde::de::Error::duplicate_field("gradient"));
                            }
                            color__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_style::custom_chat_color::Color::Gradient)
;
                        }
                    }
                }
                Ok(chat_style::CustomChatColor {
                    id: id__.unwrap_or_default(),
                    color: color__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ChatStyle.CustomChatColor", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for chat_style::Gradient {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.angle != 0 {
            len += 1;
        }
        if !self.colors.is_empty() {
            len += 1;
        }
        if !self.positions.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ChatStyle.Gradient", len)?;
        if self.angle != 0 {
            struct_ser.serialize_field("angle", &self.angle)?;
        }
        if !self.colors.is_empty() {
            struct_ser.serialize_field("colors", &self.colors)?;
        }
        if !self.positions.is_empty() {
            struct_ser.serialize_field("positions", &self.positions)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for chat_style::Gradient {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "angle",
            "colors",
            "positions",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Angle,
            Colors,
            Positions,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "angle" => Ok(GeneratedField::Angle),
                            "colors" => Ok(GeneratedField::Colors),
                            "positions" => Ok(GeneratedField::Positions),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = chat_style::Gradient;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ChatStyle.Gradient")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<chat_style::Gradient, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut angle__ = None;
                let mut colors__ = None;
                let mut positions__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Angle => {
                            if angle__.is_some() {
                                return Err(serde::de::Error::duplicate_field("angle"));
                            }
                            angle__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Colors => {
                            if colors__.is_some() {
                                return Err(serde::de::Error::duplicate_field("colors"));
                            }
                            colors__ = 
                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
                                    .into_iter().map(|x| x.0).collect())
                            ;
                        }
                        GeneratedField::Positions => {
                            if positions__.is_some() {
                                return Err(serde::de::Error::duplicate_field("positions"));
                            }
                            positions__ = 
                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
                                    .into_iter().map(|x| x.0).collect())
                            ;
                        }
                    }
                }
                Ok(chat_style::Gradient {
                    angle: angle__.unwrap_or_default(),
                    colors: colors__.unwrap_or_default(),
                    positions: positions__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ChatStyle.Gradient", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for chat_style::WallpaperPreset {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::UnknownWallpaperPreset => "UNKNOWN_WALLPAPER_PRESET",
            Self::SolidBlush => "SOLID_BLUSH",
            Self::SolidCopper => "SOLID_COPPER",
            Self::SolidDust => "SOLID_DUST",
            Self::SolidCeladon => "SOLID_CELADON",
            Self::SolidRainforest => "SOLID_RAINFOREST",
            Self::SolidPacific => "SOLID_PACIFIC",
            Self::SolidFrost => "SOLID_FROST",
            Self::SolidNavy => "SOLID_NAVY",
            Self::SolidLilac => "SOLID_LILAC",
            Self::SolidPink => "SOLID_PINK",
            Self::SolidEggplant => "SOLID_EGGPLANT",
            Self::SolidSilver => "SOLID_SILVER",
            Self::GradientSunset => "GRADIENT_SUNSET",
            Self::GradientNoir => "GRADIENT_NOIR",
            Self::GradientHeatmap => "GRADIENT_HEATMAP",
            Self::GradientAqua => "GRADIENT_AQUA",
            Self::GradientIridescent => "GRADIENT_IRIDESCENT",
            Self::GradientMonstera => "GRADIENT_MONSTERA",
            Self::GradientBliss => "GRADIENT_BLISS",
            Self::GradientSky => "GRADIENT_SKY",
            Self::GradientPeach => "GRADIENT_PEACH",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for chat_style::WallpaperPreset {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN_WALLPAPER_PRESET",
            "SOLID_BLUSH",
            "SOLID_COPPER",
            "SOLID_DUST",
            "SOLID_CELADON",
            "SOLID_RAINFOREST",
            "SOLID_PACIFIC",
            "SOLID_FROST",
            "SOLID_NAVY",
            "SOLID_LILAC",
            "SOLID_PINK",
            "SOLID_EGGPLANT",
            "SOLID_SILVER",
            "GRADIENT_SUNSET",
            "GRADIENT_NOIR",
            "GRADIENT_HEATMAP",
            "GRADIENT_AQUA",
            "GRADIENT_IRIDESCENT",
            "GRADIENT_MONSTERA",
            "GRADIENT_BLISS",
            "GRADIENT_SKY",
            "GRADIENT_PEACH",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = chat_style::WallpaperPreset;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN_WALLPAPER_PRESET" => Ok(chat_style::WallpaperPreset::UnknownWallpaperPreset),
                    "SOLID_BLUSH" => Ok(chat_style::WallpaperPreset::SolidBlush),
                    "SOLID_COPPER" => Ok(chat_style::WallpaperPreset::SolidCopper),
                    "SOLID_DUST" => Ok(chat_style::WallpaperPreset::SolidDust),
                    "SOLID_CELADON" => Ok(chat_style::WallpaperPreset::SolidCeladon),
                    "SOLID_RAINFOREST" => Ok(chat_style::WallpaperPreset::SolidRainforest),
                    "SOLID_PACIFIC" => Ok(chat_style::WallpaperPreset::SolidPacific),
                    "SOLID_FROST" => Ok(chat_style::WallpaperPreset::SolidFrost),
                    "SOLID_NAVY" => Ok(chat_style::WallpaperPreset::SolidNavy),
                    "SOLID_LILAC" => Ok(chat_style::WallpaperPreset::SolidLilac),
                    "SOLID_PINK" => Ok(chat_style::WallpaperPreset::SolidPink),
                    "SOLID_EGGPLANT" => Ok(chat_style::WallpaperPreset::SolidEggplant),
                    "SOLID_SILVER" => Ok(chat_style::WallpaperPreset::SolidSilver),
                    "GRADIENT_SUNSET" => Ok(chat_style::WallpaperPreset::GradientSunset),
                    "GRADIENT_NOIR" => Ok(chat_style::WallpaperPreset::GradientNoir),
                    "GRADIENT_HEATMAP" => Ok(chat_style::WallpaperPreset::GradientHeatmap),
                    "GRADIENT_AQUA" => Ok(chat_style::WallpaperPreset::GradientAqua),
                    "GRADIENT_IRIDESCENT" => Ok(chat_style::WallpaperPreset::GradientIridescent),
                    "GRADIENT_MONSTERA" => Ok(chat_style::WallpaperPreset::GradientMonstera),
                    "GRADIENT_BLISS" => Ok(chat_style::WallpaperPreset::GradientBliss),
                    "GRADIENT_SKY" => Ok(chat_style::WallpaperPreset::GradientSky),
                    "GRADIENT_PEACH" => Ok(chat_style::WallpaperPreset::GradientPeach),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for ChatUpdateMessage {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.update.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ChatUpdateMessage", len)?;
        if let Some(v) = self.update.as_ref() {
            match v {
                chat_update_message::Update::SimpleUpdate(v) => {
                    struct_ser.serialize_field("simpleUpdate", v)?;
                }
                chat_update_message::Update::GroupChange(v) => {
                    struct_ser.serialize_field("groupChange", v)?;
                }
                chat_update_message::Update::ExpirationTimerChange(v) => {
                    struct_ser.serialize_field("expirationTimerChange", v)?;
                }
                chat_update_message::Update::ProfileChange(v) => {
                    struct_ser.serialize_field("profileChange", v)?;
                }
                chat_update_message::Update::ThreadMerge(v) => {
                    struct_ser.serialize_field("threadMerge", v)?;
                }
                chat_update_message::Update::SessionSwitchover(v) => {
                    struct_ser.serialize_field("sessionSwitchover", v)?;
                }
                chat_update_message::Update::IndividualCall(v) => {
                    struct_ser.serialize_field("individualCall", v)?;
                }
                chat_update_message::Update::GroupCall(v) => {
                    struct_ser.serialize_field("groupCall", v)?;
                }
                chat_update_message::Update::LearnedProfileChange(v) => {
                    struct_ser.serialize_field("learnedProfileChange", v)?;
                }
                chat_update_message::Update::PollTerminate(v) => {
                    struct_ser.serialize_field("pollTerminate", v)?;
                }
                chat_update_message::Update::PinMessage(v) => {
                    struct_ser.serialize_field("pinMessage", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ChatUpdateMessage {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "simpleUpdate",
            "groupChange",
            "expirationTimerChange",
            "profileChange",
            "threadMerge",
            "sessionSwitchover",
            "individualCall",
            "groupCall",
            "learnedProfileChange",
            "pollTerminate",
            "pinMessage",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            SimpleUpdate,
            GroupChange,
            ExpirationTimerChange,
            ProfileChange,
            ThreadMerge,
            SessionSwitchover,
            IndividualCall,
            GroupCall,
            LearnedProfileChange,
            PollTerminate,
            PinMessage,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "simpleUpdate" => Ok(GeneratedField::SimpleUpdate),
                            "groupChange" => Ok(GeneratedField::GroupChange),
                            "expirationTimerChange" => Ok(GeneratedField::ExpirationTimerChange),
                            "profileChange" => Ok(GeneratedField::ProfileChange),
                            "threadMerge" => Ok(GeneratedField::ThreadMerge),
                            "sessionSwitchover" => Ok(GeneratedField::SessionSwitchover),
                            "individualCall" => Ok(GeneratedField::IndividualCall),
                            "groupCall" => Ok(GeneratedField::GroupCall),
                            "learnedProfileChange" => Ok(GeneratedField::LearnedProfileChange),
                            "pollTerminate" => Ok(GeneratedField::PollTerminate),
                            "pinMessage" => Ok(GeneratedField::PinMessage),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ChatUpdateMessage;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ChatUpdateMessage")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ChatUpdateMessage, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut update__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::SimpleUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("simpleUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_update_message::Update::SimpleUpdate)
;
                        }
                        GeneratedField::GroupChange => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupChange"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_update_message::Update::GroupChange)
;
                        }
                        GeneratedField::ExpirationTimerChange => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("expirationTimerChange"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_update_message::Update::ExpirationTimerChange)
;
                        }
                        GeneratedField::ProfileChange => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("profileChange"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_update_message::Update::ProfileChange)
;
                        }
                        GeneratedField::ThreadMerge => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("threadMerge"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_update_message::Update::ThreadMerge)
;
                        }
                        GeneratedField::SessionSwitchover => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sessionSwitchover"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_update_message::Update::SessionSwitchover)
;
                        }
                        GeneratedField::IndividualCall => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("individualCall"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_update_message::Update::IndividualCall)
;
                        }
                        GeneratedField::GroupCall => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupCall"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_update_message::Update::GroupCall)
;
                        }
                        GeneratedField::LearnedProfileChange => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("learnedProfileChange"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_update_message::Update::LearnedProfileChange)
;
                        }
                        GeneratedField::PollTerminate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("pollTerminate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_update_message::Update::PollTerminate)
;
                        }
                        GeneratedField::PinMessage => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("pinMessage"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(chat_update_message::Update::PinMessage)
;
                        }
                    }
                }
                Ok(ChatUpdateMessage {
                    update: update__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ChatUpdateMessage", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for Contact {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.aci.is_some() {
            len += 1;
        }
        if self.pni.is_some() {
            len += 1;
        }
        if self.username.is_some() {
            len += 1;
        }
        if self.e164.is_some() {
            len += 1;
        }
        if self.blocked {
            len += 1;
        }
        if self.visibility != 0 {
            len += 1;
        }
        if self.profile_key.is_some() {
            len += 1;
        }
        if self.profile_sharing {
            len += 1;
        }
        if self.profile_given_name.is_some() {
            len += 1;
        }
        if self.profile_family_name.is_some() {
            len += 1;
        }
        if self.hide_story {
            len += 1;
        }
        if self.identity_key.is_some() {
            len += 1;
        }
        if self.identity_state != 0 {
            len += 1;
        }
        if self.nickname.is_some() {
            len += 1;
        }
        if !self.note.is_empty() {
            len += 1;
        }
        if !self.system_given_name.is_empty() {
            len += 1;
        }
        if !self.system_family_name.is_empty() {
            len += 1;
        }
        if !self.system_nickname.is_empty() {
            len += 1;
        }
        if self.avatar_color.is_some() {
            len += 1;
        }
        if self.key_transparency_data.is_some() {
            len += 1;
        }
        if self.registration.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Contact", len)?;
        if let Some(v) = self.aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("aci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if let Some(v) = self.pni.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("pni", pbjson::private::base64::encode(&v).as_str())?;
        }
        if let Some(v) = self.username.as_ref() {
            struct_ser.serialize_field("username", v)?;
        }
        if let Some(v) = self.e164.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("e164", ToString::to_string(&v).as_str())?;
        }
        if self.blocked {
            struct_ser.serialize_field("blocked", &self.blocked)?;
        }
        if self.visibility != 0 {
            let v = contact::Visibility::try_from(self.visibility)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.visibility)))?;
            struct_ser.serialize_field("visibility", &v)?;
        }
        if let Some(v) = self.profile_key.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("profileKey", pbjson::private::base64::encode(&v).as_str())?;
        }
        if self.profile_sharing {
            struct_ser.serialize_field("profileSharing", &self.profile_sharing)?;
        }
        if let Some(v) = self.profile_given_name.as_ref() {
            struct_ser.serialize_field("profileGivenName", v)?;
        }
        if let Some(v) = self.profile_family_name.as_ref() {
            struct_ser.serialize_field("profileFamilyName", v)?;
        }
        if self.hide_story {
            struct_ser.serialize_field("hideStory", &self.hide_story)?;
        }
        if let Some(v) = self.identity_key.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("identityKey", pbjson::private::base64::encode(&v).as_str())?;
        }
        if self.identity_state != 0 {
            let v = contact::IdentityState::try_from(self.identity_state)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.identity_state)))?;
            struct_ser.serialize_field("identityState", &v)?;
        }
        if let Some(v) = self.nickname.as_ref() {
            struct_ser.serialize_field("nickname", v)?;
        }
        if !self.note.is_empty() {
            struct_ser.serialize_field("note", &self.note)?;
        }
        if !self.system_given_name.is_empty() {
            struct_ser.serialize_field("systemGivenName", &self.system_given_name)?;
        }
        if !self.system_family_name.is_empty() {
            struct_ser.serialize_field("systemFamilyName", &self.system_family_name)?;
        }
        if !self.system_nickname.is_empty() {
            struct_ser.serialize_field("systemNickname", &self.system_nickname)?;
        }
        if let Some(v) = self.avatar_color.as_ref() {
            let v = AvatarColor::try_from(*v)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?;
            struct_ser.serialize_field("avatarColor", &v)?;
        }
        if let Some(v) = self.key_transparency_data.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("keyTransparencyData", pbjson::private::base64::encode(&v).as_str())?;
        }
        if let Some(v) = self.registration.as_ref() {
            match v {
                contact::Registration::Registered(v) => {
                    struct_ser.serialize_field("registered", v)?;
                }
                contact::Registration::NotRegistered(v) => {
                    struct_ser.serialize_field("notRegistered", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for Contact {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "aci",
            "pni",
            "username",
            "e164",
            "blocked",
            "visibility",
            "profileKey",
            "profileSharing",
            "profileGivenName",
            "profileFamilyName",
            "hideStory",
            "identityKey",
            "identityState",
            "nickname",
            "note",
            "systemGivenName",
            "systemFamilyName",
            "systemNickname",
            "avatarColor",
            "keyTransparencyData",
            "registered",
            "notRegistered",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Aci,
            Pni,
            Username,
            E164,
            Blocked,
            Visibility,
            ProfileKey,
            ProfileSharing,
            ProfileGivenName,
            ProfileFamilyName,
            HideStory,
            IdentityKey,
            IdentityState,
            Nickname,
            Note,
            SystemGivenName,
            SystemFamilyName,
            SystemNickname,
            AvatarColor,
            KeyTransparencyData,
            Registered,
            NotRegistered,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "aci" => Ok(GeneratedField::Aci),
                            "pni" => Ok(GeneratedField::Pni),
                            "username" => Ok(GeneratedField::Username),
                            "e164" => Ok(GeneratedField::E164),
                            "blocked" => Ok(GeneratedField::Blocked),
                            "visibility" => Ok(GeneratedField::Visibility),
                            "profileKey" => Ok(GeneratedField::ProfileKey),
                            "profileSharing" => Ok(GeneratedField::ProfileSharing),
                            "profileGivenName" => Ok(GeneratedField::ProfileGivenName),
                            "profileFamilyName" => Ok(GeneratedField::ProfileFamilyName),
                            "hideStory" => Ok(GeneratedField::HideStory),
                            "identityKey" => Ok(GeneratedField::IdentityKey),
                            "identityState" => Ok(GeneratedField::IdentityState),
                            "nickname" => Ok(GeneratedField::Nickname),
                            "note" => Ok(GeneratedField::Note),
                            "systemGivenName" => Ok(GeneratedField::SystemGivenName),
                            "systemFamilyName" => Ok(GeneratedField::SystemFamilyName),
                            "systemNickname" => Ok(GeneratedField::SystemNickname),
                            "avatarColor" => Ok(GeneratedField::AvatarColor),
                            "keyTransparencyData" => Ok(GeneratedField::KeyTransparencyData),
                            "registered" => Ok(GeneratedField::Registered),
                            "notRegistered" => Ok(GeneratedField::NotRegistered),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = Contact;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Contact")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Contact, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut aci__ = None;
                let mut pni__ = None;
                let mut username__ = None;
                let mut e164__ = None;
                let mut blocked__ = None;
                let mut visibility__ = None;
                let mut profile_key__ = None;
                let mut profile_sharing__ = None;
                let mut profile_given_name__ = None;
                let mut profile_family_name__ = None;
                let mut hide_story__ = None;
                let mut identity_key__ = None;
                let mut identity_state__ = None;
                let mut nickname__ = None;
                let mut note__ = None;
                let mut system_given_name__ = None;
                let mut system_family_name__ = None;
                let mut system_nickname__ = None;
                let mut avatar_color__ = None;
                let mut key_transparency_data__ = None;
                let mut registration__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Aci => {
                            if aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("aci"));
                            }
                            aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Pni => {
                            if pni__.is_some() {
                                return Err(serde::de::Error::duplicate_field("pni"));
                            }
                            pni__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Username => {
                            if username__.is_some() {
                                return Err(serde::de::Error::duplicate_field("username"));
                            }
                            username__ = map_.next_value()?;
                        }
                        GeneratedField::E164 => {
                            if e164__.is_some() {
                                return Err(serde::de::Error::duplicate_field("e164"));
                            }
                            e164__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Blocked => {
                            if blocked__.is_some() {
                                return Err(serde::de::Error::duplicate_field("blocked"));
                            }
                            blocked__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Visibility => {
                            if visibility__.is_some() {
                                return Err(serde::de::Error::duplicate_field("visibility"));
                            }
                            visibility__ = Some(map_.next_value::<contact::Visibility>()? as i32);
                        }
                        GeneratedField::ProfileKey => {
                            if profile_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("profileKey"));
                            }
                            profile_key__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::ProfileSharing => {
                            if profile_sharing__.is_some() {
                                return Err(serde::de::Error::duplicate_field("profileSharing"));
                            }
                            profile_sharing__ = Some(map_.next_value()?);
                        }
                        GeneratedField::ProfileGivenName => {
                            if profile_given_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("profileGivenName"));
                            }
                            profile_given_name__ = map_.next_value()?;
                        }
                        GeneratedField::ProfileFamilyName => {
                            if profile_family_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("profileFamilyName"));
                            }
                            profile_family_name__ = map_.next_value()?;
                        }
                        GeneratedField::HideStory => {
                            if hide_story__.is_some() {
                                return Err(serde::de::Error::duplicate_field("hideStory"));
                            }
                            hide_story__ = Some(map_.next_value()?);
                        }
                        GeneratedField::IdentityKey => {
                            if identity_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("identityKey"));
                            }
                            identity_key__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::IdentityState => {
                            if identity_state__.is_some() {
                                return Err(serde::de::Error::duplicate_field("identityState"));
                            }
                            identity_state__ = Some(map_.next_value::<contact::IdentityState>()? as i32);
                        }
                        GeneratedField::Nickname => {
                            if nickname__.is_some() {
                                return Err(serde::de::Error::duplicate_field("nickname"));
                            }
                            nickname__ = map_.next_value()?;
                        }
                        GeneratedField::Note => {
                            if note__.is_some() {
                                return Err(serde::de::Error::duplicate_field("note"));
                            }
                            note__ = Some(map_.next_value()?);
                        }
                        GeneratedField::SystemGivenName => {
                            if system_given_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("systemGivenName"));
                            }
                            system_given_name__ = Some(map_.next_value()?);
                        }
                        GeneratedField::SystemFamilyName => {
                            if system_family_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("systemFamilyName"));
                            }
                            system_family_name__ = Some(map_.next_value()?);
                        }
                        GeneratedField::SystemNickname => {
                            if system_nickname__.is_some() {
                                return Err(serde::de::Error::duplicate_field("systemNickname"));
                            }
                            system_nickname__ = Some(map_.next_value()?);
                        }
                        GeneratedField::AvatarColor => {
                            if avatar_color__.is_some() {
                                return Err(serde::de::Error::duplicate_field("avatarColor"));
                            }
                            avatar_color__ = map_.next_value::<::std::option::Option<AvatarColor>>()?.map(|x| x as i32);
                        }
                        GeneratedField::KeyTransparencyData => {
                            if key_transparency_data__.is_some() {
                                return Err(serde::de::Error::duplicate_field("keyTransparencyData"));
                            }
                            key_transparency_data__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Registered => {
                            if registration__.is_some() {
                                return Err(serde::de::Error::duplicate_field("registered"));
                            }
                            registration__ = map_.next_value::<::std::option::Option<_>>()?.map(contact::Registration::Registered)
;
                        }
                        GeneratedField::NotRegistered => {
                            if registration__.is_some() {
                                return Err(serde::de::Error::duplicate_field("notRegistered"));
                            }
                            registration__ = map_.next_value::<::std::option::Option<_>>()?.map(contact::Registration::NotRegistered)
;
                        }
                    }
                }
                Ok(Contact {
                    aci: aci__,
                    pni: pni__,
                    username: username__,
                    e164: e164__,
                    blocked: blocked__.unwrap_or_default(),
                    visibility: visibility__.unwrap_or_default(),
                    profile_key: profile_key__,
                    profile_sharing: profile_sharing__.unwrap_or_default(),
                    profile_given_name: profile_given_name__,
                    profile_family_name: profile_family_name__,
                    hide_story: hide_story__.unwrap_or_default(),
                    identity_key: identity_key__,
                    identity_state: identity_state__.unwrap_or_default(),
                    nickname: nickname__,
                    note: note__.unwrap_or_default(),
                    system_given_name: system_given_name__.unwrap_or_default(),
                    system_family_name: system_family_name__.unwrap_or_default(),
                    system_nickname: system_nickname__.unwrap_or_default(),
                    avatar_color: avatar_color__,
                    key_transparency_data: key_transparency_data__,
                    registration: registration__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Contact", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for contact::IdentityState {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Default => "DEFAULT",
            Self::Verified => "VERIFIED",
            Self::Unverified => "UNVERIFIED",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for contact::IdentityState {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "DEFAULT",
            "VERIFIED",
            "UNVERIFIED",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = contact::IdentityState;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "DEFAULT" => Ok(contact::IdentityState::Default),
                    "VERIFIED" => Ok(contact::IdentityState::Verified),
                    "UNVERIFIED" => Ok(contact::IdentityState::Unverified),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for contact::Name {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.given.is_empty() {
            len += 1;
        }
        if !self.family.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Contact.Name", len)?;
        if !self.given.is_empty() {
            struct_ser.serialize_field("given", &self.given)?;
        }
        if !self.family.is_empty() {
            struct_ser.serialize_field("family", &self.family)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for contact::Name {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "given",
            "family",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Given,
            Family,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "given" => Ok(GeneratedField::Given),
                            "family" => Ok(GeneratedField::Family),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = contact::Name;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Contact.Name")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<contact::Name, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut given__ = None;
                let mut family__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Given => {
                            if given__.is_some() {
                                return Err(serde::de::Error::duplicate_field("given"));
                            }
                            given__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Family => {
                            if family__.is_some() {
                                return Err(serde::de::Error::duplicate_field("family"));
                            }
                            family__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(contact::Name {
                    given: given__.unwrap_or_default(),
                    family: family__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Contact.Name", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for contact::NotRegistered {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.unregistered_timestamp != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Contact.NotRegistered", len)?;
        if self.unregistered_timestamp != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("unregisteredTimestamp", ToString::to_string(&self.unregistered_timestamp).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for contact::NotRegistered {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "unregisteredTimestamp",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UnregisteredTimestamp,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "unregisteredTimestamp" => Ok(GeneratedField::UnregisteredTimestamp),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = contact::NotRegistered;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Contact.NotRegistered")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<contact::NotRegistered, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut unregistered_timestamp__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UnregisteredTimestamp => {
                            if unregistered_timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("unregisteredTimestamp"));
                            }
                            unregistered_timestamp__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(contact::NotRegistered {
                    unregistered_timestamp: unregistered_timestamp__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Contact.NotRegistered", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for contact::Registered {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let len = 0;
        let struct_ser = serializer.serialize_struct("signal.backup.Contact.Registered", len)?;
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for contact::Registered {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                            Err(serde::de::Error::unknown_field(value, FIELDS))
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = contact::Registered;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Contact.Registered")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<contact::Registered, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                while map_.next_key::<GeneratedField>()?.is_some() {
                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
                }
                Ok(contact::Registered {
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Contact.Registered", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for contact::Visibility {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Visible => "VISIBLE",
            Self::Hidden => "HIDDEN",
            Self::HiddenMessageRequest => "HIDDEN_MESSAGE_REQUEST",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for contact::Visibility {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "VISIBLE",
            "HIDDEN",
            "HIDDEN_MESSAGE_REQUEST",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = contact::Visibility;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "VISIBLE" => Ok(contact::Visibility::Visible),
                    "HIDDEN" => Ok(contact::Visibility::Hidden),
                    "HIDDEN_MESSAGE_REQUEST" => Ok(contact::Visibility::HiddenMessageRequest),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for ContactAttachment {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.name.is_some() {
            len += 1;
        }
        if !self.number.is_empty() {
            len += 1;
        }
        if !self.email.is_empty() {
            len += 1;
        }
        if !self.address.is_empty() {
            len += 1;
        }
        if self.avatar.is_some() {
            len += 1;
        }
        if !self.organization.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ContactAttachment", len)?;
        if let Some(v) = self.name.as_ref() {
            struct_ser.serialize_field("name", v)?;
        }
        if !self.number.is_empty() {
            struct_ser.serialize_field("number", &self.number)?;
        }
        if !self.email.is_empty() {
            struct_ser.serialize_field("email", &self.email)?;
        }
        if !self.address.is_empty() {
            struct_ser.serialize_field("address", &self.address)?;
        }
        if let Some(v) = self.avatar.as_ref() {
            struct_ser.serialize_field("avatar", v)?;
        }
        if !self.organization.is_empty() {
            struct_ser.serialize_field("organization", &self.organization)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ContactAttachment {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "name",
            "number",
            "email",
            "address",
            "avatar",
            "organization",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Name,
            Number,
            Email,
            Address,
            Avatar,
            Organization,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "name" => Ok(GeneratedField::Name),
                            "number" => Ok(GeneratedField::Number),
                            "email" => Ok(GeneratedField::Email),
                            "address" => Ok(GeneratedField::Address),
                            "avatar" => Ok(GeneratedField::Avatar),
                            "organization" => Ok(GeneratedField::Organization),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ContactAttachment;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ContactAttachment")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ContactAttachment, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut name__ = None;
                let mut number__ = None;
                let mut email__ = None;
                let mut address__ = None;
                let mut avatar__ = None;
                let mut organization__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Name => {
                            if name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("name"));
                            }
                            name__ = map_.next_value()?;
                        }
                        GeneratedField::Number => {
                            if number__.is_some() {
                                return Err(serde::de::Error::duplicate_field("number"));
                            }
                            number__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Email => {
                            if email__.is_some() {
                                return Err(serde::de::Error::duplicate_field("email"));
                            }
                            email__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Address => {
                            if address__.is_some() {
                                return Err(serde::de::Error::duplicate_field("address"));
                            }
                            address__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Avatar => {
                            if avatar__.is_some() {
                                return Err(serde::de::Error::duplicate_field("avatar"));
                            }
                            avatar__ = map_.next_value()?;
                        }
                        GeneratedField::Organization => {
                            if organization__.is_some() {
                                return Err(serde::de::Error::duplicate_field("organization"));
                            }
                            organization__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(ContactAttachment {
                    name: name__,
                    number: number__.unwrap_or_default(),
                    email: email__.unwrap_or_default(),
                    address: address__.unwrap_or_default(),
                    avatar: avatar__,
                    organization: organization__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ContactAttachment", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for contact_attachment::Email {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.value.is_empty() {
            len += 1;
        }
        if self.r#type != 0 {
            len += 1;
        }
        if !self.label.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ContactAttachment.Email", len)?;
        if !self.value.is_empty() {
            struct_ser.serialize_field("value", &self.value)?;
        }
        if self.r#type != 0 {
            let v = contact_attachment::email::Type::try_from(self.r#type)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.r#type)))?;
            struct_ser.serialize_field("type", &v)?;
        }
        if !self.label.is_empty() {
            struct_ser.serialize_field("label", &self.label)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for contact_attachment::Email {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "value",
            "type",
            "label",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Value,
            Type,
            Label,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "value" => Ok(GeneratedField::Value),
                            "type" => Ok(GeneratedField::Type),
                            "label" => Ok(GeneratedField::Label),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = contact_attachment::Email;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ContactAttachment.Email")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<contact_attachment::Email, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut value__ = None;
                let mut r#type__ = None;
                let mut label__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Value => {
                            if value__.is_some() {
                                return Err(serde::de::Error::duplicate_field("value"));
                            }
                            value__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Type => {
                            if r#type__.is_some() {
                                return Err(serde::de::Error::duplicate_field("type"));
                            }
                            r#type__ = Some(map_.next_value::<contact_attachment::email::Type>()? as i32);
                        }
                        GeneratedField::Label => {
                            if label__.is_some() {
                                return Err(serde::de::Error::duplicate_field("label"));
                            }
                            label__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(contact_attachment::Email {
                    value: value__.unwrap_or_default(),
                    r#type: r#type__.unwrap_or_default(),
                    label: label__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ContactAttachment.Email", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for contact_attachment::email::Type {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::Home => "HOME",
            Self::Mobile => "MOBILE",
            Self::Work => "WORK",
            Self::Custom => "CUSTOM",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for contact_attachment::email::Type {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "HOME",
            "MOBILE",
            "WORK",
            "CUSTOM",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = contact_attachment::email::Type;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(contact_attachment::email::Type::Unknown),
                    "HOME" => Ok(contact_attachment::email::Type::Home),
                    "MOBILE" => Ok(contact_attachment::email::Type::Mobile),
                    "WORK" => Ok(contact_attachment::email::Type::Work),
                    "CUSTOM" => Ok(contact_attachment::email::Type::Custom),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for contact_attachment::Name {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.given_name.is_empty() {
            len += 1;
        }
        if !self.family_name.is_empty() {
            len += 1;
        }
        if !self.prefix.is_empty() {
            len += 1;
        }
        if !self.suffix.is_empty() {
            len += 1;
        }
        if !self.middle_name.is_empty() {
            len += 1;
        }
        if !self.nickname.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ContactAttachment.Name", len)?;
        if !self.given_name.is_empty() {
            struct_ser.serialize_field("givenName", &self.given_name)?;
        }
        if !self.family_name.is_empty() {
            struct_ser.serialize_field("familyName", &self.family_name)?;
        }
        if !self.prefix.is_empty() {
            struct_ser.serialize_field("prefix", &self.prefix)?;
        }
        if !self.suffix.is_empty() {
            struct_ser.serialize_field("suffix", &self.suffix)?;
        }
        if !self.middle_name.is_empty() {
            struct_ser.serialize_field("middleName", &self.middle_name)?;
        }
        if !self.nickname.is_empty() {
            struct_ser.serialize_field("nickname", &self.nickname)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for contact_attachment::Name {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "givenName",
            "familyName",
            "prefix",
            "suffix",
            "middleName",
            "nickname",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            GivenName,
            FamilyName,
            Prefix,
            Suffix,
            MiddleName,
            Nickname,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "givenName" => Ok(GeneratedField::GivenName),
                            "familyName" => Ok(GeneratedField::FamilyName),
                            "prefix" => Ok(GeneratedField::Prefix),
                            "suffix" => Ok(GeneratedField::Suffix),
                            "middleName" => Ok(GeneratedField::MiddleName),
                            "nickname" => Ok(GeneratedField::Nickname),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = contact_attachment::Name;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ContactAttachment.Name")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<contact_attachment::Name, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut given_name__ = None;
                let mut family_name__ = None;
                let mut prefix__ = None;
                let mut suffix__ = None;
                let mut middle_name__ = None;
                let mut nickname__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::GivenName => {
                            if given_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("givenName"));
                            }
                            given_name__ = Some(map_.next_value()?);
                        }
                        GeneratedField::FamilyName => {
                            if family_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("familyName"));
                            }
                            family_name__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Prefix => {
                            if prefix__.is_some() {
                                return Err(serde::de::Error::duplicate_field("prefix"));
                            }
                            prefix__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Suffix => {
                            if suffix__.is_some() {
                                return Err(serde::de::Error::duplicate_field("suffix"));
                            }
                            suffix__ = Some(map_.next_value()?);
                        }
                        GeneratedField::MiddleName => {
                            if middle_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("middleName"));
                            }
                            middle_name__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Nickname => {
                            if nickname__.is_some() {
                                return Err(serde::de::Error::duplicate_field("nickname"));
                            }
                            nickname__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(contact_attachment::Name {
                    given_name: given_name__.unwrap_or_default(),
                    family_name: family_name__.unwrap_or_default(),
                    prefix: prefix__.unwrap_or_default(),
                    suffix: suffix__.unwrap_or_default(),
                    middle_name: middle_name__.unwrap_or_default(),
                    nickname: nickname__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ContactAttachment.Name", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for contact_attachment::Phone {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.value.is_empty() {
            len += 1;
        }
        if self.r#type != 0 {
            len += 1;
        }
        if !self.label.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ContactAttachment.Phone", len)?;
        if !self.value.is_empty() {
            struct_ser.serialize_field("value", &self.value)?;
        }
        if self.r#type != 0 {
            let v = contact_attachment::phone::Type::try_from(self.r#type)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.r#type)))?;
            struct_ser.serialize_field("type", &v)?;
        }
        if !self.label.is_empty() {
            struct_ser.serialize_field("label", &self.label)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for contact_attachment::Phone {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "value",
            "type",
            "label",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Value,
            Type,
            Label,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "value" => Ok(GeneratedField::Value),
                            "type" => Ok(GeneratedField::Type),
                            "label" => Ok(GeneratedField::Label),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = contact_attachment::Phone;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ContactAttachment.Phone")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<contact_attachment::Phone, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut value__ = None;
                let mut r#type__ = None;
                let mut label__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Value => {
                            if value__.is_some() {
                                return Err(serde::de::Error::duplicate_field("value"));
                            }
                            value__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Type => {
                            if r#type__.is_some() {
                                return Err(serde::de::Error::duplicate_field("type"));
                            }
                            r#type__ = Some(map_.next_value::<contact_attachment::phone::Type>()? as i32);
                        }
                        GeneratedField::Label => {
                            if label__.is_some() {
                                return Err(serde::de::Error::duplicate_field("label"));
                            }
                            label__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(contact_attachment::Phone {
                    value: value__.unwrap_or_default(),
                    r#type: r#type__.unwrap_or_default(),
                    label: label__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ContactAttachment.Phone", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for contact_attachment::phone::Type {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::Home => "HOME",
            Self::Mobile => "MOBILE",
            Self::Work => "WORK",
            Self::Custom => "CUSTOM",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for contact_attachment::phone::Type {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "HOME",
            "MOBILE",
            "WORK",
            "CUSTOM",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = contact_attachment::phone::Type;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(contact_attachment::phone::Type::Unknown),
                    "HOME" => Ok(contact_attachment::phone::Type::Home),
                    "MOBILE" => Ok(contact_attachment::phone::Type::Mobile),
                    "WORK" => Ok(contact_attachment::phone::Type::Work),
                    "CUSTOM" => Ok(contact_attachment::phone::Type::Custom),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for contact_attachment::PostalAddress {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.r#type != 0 {
            len += 1;
        }
        if !self.label.is_empty() {
            len += 1;
        }
        if !self.street.is_empty() {
            len += 1;
        }
        if !self.pobox.is_empty() {
            len += 1;
        }
        if !self.neighborhood.is_empty() {
            len += 1;
        }
        if !self.city.is_empty() {
            len += 1;
        }
        if !self.region.is_empty() {
            len += 1;
        }
        if !self.postcode.is_empty() {
            len += 1;
        }
        if !self.country.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ContactAttachment.PostalAddress", len)?;
        if self.r#type != 0 {
            let v = contact_attachment::postal_address::Type::try_from(self.r#type)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.r#type)))?;
            struct_ser.serialize_field("type", &v)?;
        }
        if !self.label.is_empty() {
            struct_ser.serialize_field("label", &self.label)?;
        }
        if !self.street.is_empty() {
            struct_ser.serialize_field("street", &self.street)?;
        }
        if !self.pobox.is_empty() {
            struct_ser.serialize_field("pobox", &self.pobox)?;
        }
        if !self.neighborhood.is_empty() {
            struct_ser.serialize_field("neighborhood", &self.neighborhood)?;
        }
        if !self.city.is_empty() {
            struct_ser.serialize_field("city", &self.city)?;
        }
        if !self.region.is_empty() {
            struct_ser.serialize_field("region", &self.region)?;
        }
        if !self.postcode.is_empty() {
            struct_ser.serialize_field("postcode", &self.postcode)?;
        }
        if !self.country.is_empty() {
            struct_ser.serialize_field("country", &self.country)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for contact_attachment::PostalAddress {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "type",
            "label",
            "street",
            "pobox",
            "neighborhood",
            "city",
            "region",
            "postcode",
            "country",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Type,
            Label,
            Street,
            Pobox,
            Neighborhood,
            City,
            Region,
            Postcode,
            Country,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "type" => Ok(GeneratedField::Type),
                            "label" => Ok(GeneratedField::Label),
                            "street" => Ok(GeneratedField::Street),
                            "pobox" => Ok(GeneratedField::Pobox),
                            "neighborhood" => Ok(GeneratedField::Neighborhood),
                            "city" => Ok(GeneratedField::City),
                            "region" => Ok(GeneratedField::Region),
                            "postcode" => Ok(GeneratedField::Postcode),
                            "country" => Ok(GeneratedField::Country),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = contact_attachment::PostalAddress;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ContactAttachment.PostalAddress")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<contact_attachment::PostalAddress, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut r#type__ = None;
                let mut label__ = None;
                let mut street__ = None;
                let mut pobox__ = None;
                let mut neighborhood__ = None;
                let mut city__ = None;
                let mut region__ = None;
                let mut postcode__ = None;
                let mut country__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Type => {
                            if r#type__.is_some() {
                                return Err(serde::de::Error::duplicate_field("type"));
                            }
                            r#type__ = Some(map_.next_value::<contact_attachment::postal_address::Type>()? as i32);
                        }
                        GeneratedField::Label => {
                            if label__.is_some() {
                                return Err(serde::de::Error::duplicate_field("label"));
                            }
                            label__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Street => {
                            if street__.is_some() {
                                return Err(serde::de::Error::duplicate_field("street"));
                            }
                            street__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Pobox => {
                            if pobox__.is_some() {
                                return Err(serde::de::Error::duplicate_field("pobox"));
                            }
                            pobox__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Neighborhood => {
                            if neighborhood__.is_some() {
                                return Err(serde::de::Error::duplicate_field("neighborhood"));
                            }
                            neighborhood__ = Some(map_.next_value()?);
                        }
                        GeneratedField::City => {
                            if city__.is_some() {
                                return Err(serde::de::Error::duplicate_field("city"));
                            }
                            city__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Region => {
                            if region__.is_some() {
                                return Err(serde::de::Error::duplicate_field("region"));
                            }
                            region__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Postcode => {
                            if postcode__.is_some() {
                                return Err(serde::de::Error::duplicate_field("postcode"));
                            }
                            postcode__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Country => {
                            if country__.is_some() {
                                return Err(serde::de::Error::duplicate_field("country"));
                            }
                            country__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(contact_attachment::PostalAddress {
                    r#type: r#type__.unwrap_or_default(),
                    label: label__.unwrap_or_default(),
                    street: street__.unwrap_or_default(),
                    pobox: pobox__.unwrap_or_default(),
                    neighborhood: neighborhood__.unwrap_or_default(),
                    city: city__.unwrap_or_default(),
                    region: region__.unwrap_or_default(),
                    postcode: postcode__.unwrap_or_default(),
                    country: country__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ContactAttachment.PostalAddress", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for contact_attachment::postal_address::Type {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::Home => "HOME",
            Self::Work => "WORK",
            Self::Custom => "CUSTOM",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for contact_attachment::postal_address::Type {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "HOME",
            "WORK",
            "CUSTOM",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = contact_attachment::postal_address::Type;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(contact_attachment::postal_address::Type::Unknown),
                    "HOME" => Ok(contact_attachment::postal_address::Type::Home),
                    "WORK" => Ok(contact_attachment::postal_address::Type::Work),
                    "CUSTOM" => Ok(contact_attachment::postal_address::Type::Custom),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for ContactMessage {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.contact.is_some() {
            len += 1;
        }
        if !self.reactions.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ContactMessage", len)?;
        if let Some(v) = self.contact.as_ref() {
            struct_ser.serialize_field("contact", v)?;
        }
        if !self.reactions.is_empty() {
            struct_ser.serialize_field("reactions", &self.reactions)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ContactMessage {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "contact",
            "reactions",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Contact,
            Reactions,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "contact" => Ok(GeneratedField::Contact),
                            "reactions" => Ok(GeneratedField::Reactions),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ContactMessage;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ContactMessage")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ContactMessage, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut contact__ = None;
                let mut reactions__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Contact => {
                            if contact__.is_some() {
                                return Err(serde::de::Error::duplicate_field("contact"));
                            }
                            contact__ = map_.next_value()?;
                        }
                        GeneratedField::Reactions => {
                            if reactions__.is_some() {
                                return Err(serde::de::Error::duplicate_field("reactions"));
                            }
                            reactions__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(ContactMessage {
                    contact: contact__,
                    reactions: reactions__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ContactMessage", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for DirectStoryReplyMessage {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.reactions.is_empty() {
            len += 1;
        }
        if self.reply.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.DirectStoryReplyMessage", len)?;
        if !self.reactions.is_empty() {
            struct_ser.serialize_field("reactions", &self.reactions)?;
        }
        if let Some(v) = self.reply.as_ref() {
            match v {
                direct_story_reply_message::Reply::TextReply(v) => {
                    struct_ser.serialize_field("textReply", v)?;
                }
                direct_story_reply_message::Reply::Emoji(v) => {
                    struct_ser.serialize_field("emoji", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for DirectStoryReplyMessage {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "reactions",
            "textReply",
            "emoji",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Reactions,
            TextReply,
            Emoji,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "reactions" => Ok(GeneratedField::Reactions),
                            "textReply" => Ok(GeneratedField::TextReply),
                            "emoji" => Ok(GeneratedField::Emoji),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = DirectStoryReplyMessage;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.DirectStoryReplyMessage")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<DirectStoryReplyMessage, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut reactions__ = None;
                let mut reply__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Reactions => {
                            if reactions__.is_some() {
                                return Err(serde::de::Error::duplicate_field("reactions"));
                            }
                            reactions__ = Some(map_.next_value()?);
                        }
                        GeneratedField::TextReply => {
                            if reply__.is_some() {
                                return Err(serde::de::Error::duplicate_field("textReply"));
                            }
                            reply__ = map_.next_value::<::std::option::Option<_>>()?.map(direct_story_reply_message::Reply::TextReply)
;
                        }
                        GeneratedField::Emoji => {
                            if reply__.is_some() {
                                return Err(serde::de::Error::duplicate_field("emoji"));
                            }
                            reply__ = map_.next_value::<::std::option::Option<_>>()?.map(direct_story_reply_message::Reply::Emoji);
                        }
                    }
                }
                Ok(DirectStoryReplyMessage {
                    reactions: reactions__.unwrap_or_default(),
                    reply: reply__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.DirectStoryReplyMessage", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for direct_story_reply_message::TextReply {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.text.is_some() {
            len += 1;
        }
        if self.long_text.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.DirectStoryReplyMessage.TextReply", len)?;
        if let Some(v) = self.text.as_ref() {
            struct_ser.serialize_field("text", v)?;
        }
        if let Some(v) = self.long_text.as_ref() {
            struct_ser.serialize_field("longText", v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for direct_story_reply_message::TextReply {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "text",
            "longText",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Text,
            LongText,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "text" => Ok(GeneratedField::Text),
                            "longText" => Ok(GeneratedField::LongText),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = direct_story_reply_message::TextReply;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.DirectStoryReplyMessage.TextReply")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<direct_story_reply_message::TextReply, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut text__ = None;
                let mut long_text__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Text => {
                            if text__.is_some() {
                                return Err(serde::de::Error::duplicate_field("text"));
                            }
                            text__ = map_.next_value()?;
                        }
                        GeneratedField::LongText => {
                            if long_text__.is_some() {
                                return Err(serde::de::Error::duplicate_field("longText"));
                            }
                            long_text__ = map_.next_value()?;
                        }
                    }
                }
                Ok(direct_story_reply_message::TextReply {
                    text: text__,
                    long_text: long_text__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.DirectStoryReplyMessage.TextReply", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for DistributionList {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.name.is_empty() {
            len += 1;
        }
        if self.allow_replies {
            len += 1;
        }
        if self.privacy_mode != 0 {
            len += 1;
        }
        if !self.member_recipient_ids.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.DistributionList", len)?;
        if !self.name.is_empty() {
            struct_ser.serialize_field("name", &self.name)?;
        }
        if self.allow_replies {
            struct_ser.serialize_field("allowReplies", &self.allow_replies)?;
        }
        if self.privacy_mode != 0 {
            let v = distribution_list::PrivacyMode::try_from(self.privacy_mode)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.privacy_mode)))?;
            struct_ser.serialize_field("privacyMode", &v)?;
        }
        if !self.member_recipient_ids.is_empty() {
            struct_ser.serialize_field("memberRecipientIds", &self.member_recipient_ids.iter().map(ToString::to_string).collect::<Vec<_>>())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for DistributionList {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "name",
            "allowReplies",
            "privacyMode",
            "memberRecipientIds",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Name,
            AllowReplies,
            PrivacyMode,
            MemberRecipientIds,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "name" => Ok(GeneratedField::Name),
                            "allowReplies" => Ok(GeneratedField::AllowReplies),
                            "privacyMode" => Ok(GeneratedField::PrivacyMode),
                            "memberRecipientIds" => Ok(GeneratedField::MemberRecipientIds),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = DistributionList;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.DistributionList")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<DistributionList, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut name__ = None;
                let mut allow_replies__ = None;
                let mut privacy_mode__ = None;
                let mut member_recipient_ids__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Name => {
                            if name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("name"));
                            }
                            name__ = Some(map_.next_value()?);
                        }
                        GeneratedField::AllowReplies => {
                            if allow_replies__.is_some() {
                                return Err(serde::de::Error::duplicate_field("allowReplies"));
                            }
                            allow_replies__ = Some(map_.next_value()?);
                        }
                        GeneratedField::PrivacyMode => {
                            if privacy_mode__.is_some() {
                                return Err(serde::de::Error::duplicate_field("privacyMode"));
                            }
                            privacy_mode__ = Some(map_.next_value::<distribution_list::PrivacyMode>()? as i32);
                        }
                        GeneratedField::MemberRecipientIds => {
                            if member_recipient_ids__.is_some() {
                                return Err(serde::de::Error::duplicate_field("memberRecipientIds"));
                            }
                            member_recipient_ids__ = 
                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
                                    .into_iter().map(|x| x.0).collect())
                            ;
                        }
                    }
                }
                Ok(DistributionList {
                    name: name__.unwrap_or_default(),
                    allow_replies: allow_replies__.unwrap_or_default(),
                    privacy_mode: privacy_mode__.unwrap_or_default(),
                    member_recipient_ids: member_recipient_ids__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.DistributionList", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for distribution_list::PrivacyMode {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::OnlyWith => "ONLY_WITH",
            Self::AllExcept => "ALL_EXCEPT",
            Self::All => "ALL",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for distribution_list::PrivacyMode {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "ONLY_WITH",
            "ALL_EXCEPT",
            "ALL",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = distribution_list::PrivacyMode;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(distribution_list::PrivacyMode::Unknown),
                    "ONLY_WITH" => Ok(distribution_list::PrivacyMode::OnlyWith),
                    "ALL_EXCEPT" => Ok(distribution_list::PrivacyMode::AllExcept),
                    "ALL" => Ok(distribution_list::PrivacyMode::All),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for DistributionListItem {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.distribution_id.is_empty() {
            len += 1;
        }
        if self.item.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.DistributionListItem", len)?;
        if !self.distribution_id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("distributionId", pbjson::private::base64::encode(&self.distribution_id).as_str())?;
        }
        if let Some(v) = self.item.as_ref() {
            match v {
                distribution_list_item::Item::DeletionTimestamp(v) => {
                    #[allow(clippy::needless_borrow)]
                    #[allow(clippy::needless_borrows_for_generic_args)]
                    struct_ser.serialize_field("deletionTimestamp", ToString::to_string(&v).as_str())?;
                }
                distribution_list_item::Item::DistributionList(v) => {
                    struct_ser.serialize_field("distributionList", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for DistributionListItem {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "distributionId",
            "deletionTimestamp",
            "distributionList",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            DistributionId,
            DeletionTimestamp,
            DistributionList,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "distributionId" => Ok(GeneratedField::DistributionId),
                            "deletionTimestamp" => Ok(GeneratedField::DeletionTimestamp),
                            "distributionList" => Ok(GeneratedField::DistributionList),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = DistributionListItem;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.DistributionListItem")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<DistributionListItem, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut distribution_id__ = None;
                let mut item__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::DistributionId => {
                            if distribution_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("distributionId"));
                            }
                            distribution_id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::DeletionTimestamp => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("deletionTimestamp"));
                            }
                            item__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| distribution_list_item::Item::DeletionTimestamp(x.0));
                        }
                        GeneratedField::DistributionList => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("distributionList"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(distribution_list_item::Item::DistributionList)
;
                        }
                    }
                }
                Ok(DistributionListItem {
                    distribution_id: distribution_id__.unwrap_or_default(),
                    item: item__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.DistributionListItem", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for ExpirationTimerChatUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.expires_in_ms != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ExpirationTimerChatUpdate", len)?;
        if self.expires_in_ms != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("expiresInMs", ToString::to_string(&self.expires_in_ms).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ExpirationTimerChatUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "expiresInMs",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            ExpiresInMs,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "expiresInMs" => Ok(GeneratedField::ExpiresInMs),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ExpirationTimerChatUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ExpirationTimerChatUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ExpirationTimerChatUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut expires_in_ms__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::ExpiresInMs => {
                            if expires_in_ms__.is_some() {
                                return Err(serde::de::Error::duplicate_field("expiresInMs"));
                            }
                            expires_in_ms__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(ExpirationTimerChatUpdate {
                    expires_in_ms: expires_in_ms__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ExpirationTimerChatUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for FilePointer {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.content_type.is_some() {
            len += 1;
        }
        if self.incremental_mac.is_some() {
            len += 1;
        }
        if self.incremental_mac_chunk_size.is_some() {
            len += 1;
        }
        if self.file_name.is_some() {
            len += 1;
        }
        if self.width.is_some() {
            len += 1;
        }
        if self.height.is_some() {
            len += 1;
        }
        if self.caption.is_some() {
            len += 1;
        }
        if self.blur_hash.is_some() {
            len += 1;
        }
        if self.locator_info.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.FilePointer", len)?;
        if let Some(v) = self.content_type.as_ref() {
            struct_ser.serialize_field("contentType", v)?;
        }
        if let Some(v) = self.incremental_mac.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("incrementalMac", pbjson::private::base64::encode(&v).as_str())?;
        }
        if let Some(v) = self.incremental_mac_chunk_size.as_ref() {
            struct_ser.serialize_field("incrementalMacChunkSize", v)?;
        }
        if let Some(v) = self.file_name.as_ref() {
            struct_ser.serialize_field("fileName", v)?;
        }
        if let Some(v) = self.width.as_ref() {
            struct_ser.serialize_field("width", v)?;
        }
        if let Some(v) = self.height.as_ref() {
            struct_ser.serialize_field("height", v)?;
        }
        if let Some(v) = self.caption.as_ref() {
            struct_ser.serialize_field("caption", v)?;
        }
        if let Some(v) = self.blur_hash.as_ref() {
            struct_ser.serialize_field("blurHash", v)?;
        }
        if let Some(v) = self.locator_info.as_ref() {
            struct_ser.serialize_field("locatorInfo", v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for FilePointer {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "contentType",
            "incrementalMac",
            "incrementalMacChunkSize",
            "fileName",
            "width",
            "height",
            "caption",
            "blurHash",
            "locatorInfo",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            ContentType,
            IncrementalMac,
            IncrementalMacChunkSize,
            FileName,
            Width,
            Height,
            Caption,
            BlurHash,
            LocatorInfo,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "contentType" => Ok(GeneratedField::ContentType),
                            "incrementalMac" => Ok(GeneratedField::IncrementalMac),
                            "incrementalMacChunkSize" => Ok(GeneratedField::IncrementalMacChunkSize),
                            "fileName" => Ok(GeneratedField::FileName),
                            "width" => Ok(GeneratedField::Width),
                            "height" => Ok(GeneratedField::Height),
                            "caption" => Ok(GeneratedField::Caption),
                            "blurHash" => Ok(GeneratedField::BlurHash),
                            "locatorInfo" => Ok(GeneratedField::LocatorInfo),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = FilePointer;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.FilePointer")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<FilePointer, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut content_type__ = None;
                let mut incremental_mac__ = None;
                let mut incremental_mac_chunk_size__ = None;
                let mut file_name__ = None;
                let mut width__ = None;
                let mut height__ = None;
                let mut caption__ = None;
                let mut blur_hash__ = None;
                let mut locator_info__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::ContentType => {
                            if content_type__.is_some() {
                                return Err(serde::de::Error::duplicate_field("contentType"));
                            }
                            content_type__ = map_.next_value()?;
                        }
                        GeneratedField::IncrementalMac => {
                            if incremental_mac__.is_some() {
                                return Err(serde::de::Error::duplicate_field("incrementalMac"));
                            }
                            incremental_mac__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::IncrementalMacChunkSize => {
                            if incremental_mac_chunk_size__.is_some() {
                                return Err(serde::de::Error::duplicate_field("incrementalMacChunkSize"));
                            }
                            incremental_mac_chunk_size__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::FileName => {
                            if file_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("fileName"));
                            }
                            file_name__ = map_.next_value()?;
                        }
                        GeneratedField::Width => {
                            if width__.is_some() {
                                return Err(serde::de::Error::duplicate_field("width"));
                            }
                            width__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Height => {
                            if height__.is_some() {
                                return Err(serde::de::Error::duplicate_field("height"));
                            }
                            height__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Caption => {
                            if caption__.is_some() {
                                return Err(serde::de::Error::duplicate_field("caption"));
                            }
                            caption__ = map_.next_value()?;
                        }
                        GeneratedField::BlurHash => {
                            if blur_hash__.is_some() {
                                return Err(serde::de::Error::duplicate_field("blurHash"));
                            }
                            blur_hash__ = map_.next_value()?;
                        }
                        GeneratedField::LocatorInfo => {
                            if locator_info__.is_some() {
                                return Err(serde::de::Error::duplicate_field("locatorInfo"));
                            }
                            locator_info__ = map_.next_value()?;
                        }
                    }
                }
                Ok(FilePointer {
                    content_type: content_type__,
                    incremental_mac: incremental_mac__,
                    incremental_mac_chunk_size: incremental_mac_chunk_size__,
                    file_name: file_name__,
                    width: width__,
                    height: height__,
                    caption: caption__,
                    blur_hash: blur_hash__,
                    locator_info: locator_info__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.FilePointer", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for file_pointer::LocatorInfo {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.key.is_empty() {
            len += 1;
        }
        if self.size != 0 {
            len += 1;
        }
        if self.transit_cdn_key.is_some() {
            len += 1;
        }
        if self.transit_cdn_number.is_some() {
            len += 1;
        }
        if self.transit_tier_upload_timestamp.is_some() {
            len += 1;
        }
        if self.media_tier_cdn_number.is_some() {
            len += 1;
        }
        if self.local_key.is_some() {
            len += 1;
        }
        if self.integrity_check.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.FilePointer.LocatorInfo", len)?;
        if !self.key.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("key", pbjson::private::base64::encode(&self.key).as_str())?;
        }
        if self.size != 0 {
            struct_ser.serialize_field("size", &self.size)?;
        }
        if let Some(v) = self.transit_cdn_key.as_ref() {
            struct_ser.serialize_field("transitCdnKey", v)?;
        }
        if let Some(v) = self.transit_cdn_number.as_ref() {
            struct_ser.serialize_field("transitCdnNumber", v)?;
        }
        if let Some(v) = self.transit_tier_upload_timestamp.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("transitTierUploadTimestamp", ToString::to_string(&v).as_str())?;
        }
        if let Some(v) = self.media_tier_cdn_number.as_ref() {
            struct_ser.serialize_field("mediaTierCdnNumber", v)?;
        }
        if let Some(v) = self.local_key.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("localKey", pbjson::private::base64::encode(&v).as_str())?;
        }
        if let Some(v) = self.integrity_check.as_ref() {
            match v {
                file_pointer::locator_info::IntegrityCheck::PlaintextHash(v) => {
                    #[allow(clippy::needless_borrow)]
                    #[allow(clippy::needless_borrows_for_generic_args)]
                    struct_ser.serialize_field("plaintextHash", pbjson::private::base64::encode(&v).as_str())?;
                }
                file_pointer::locator_info::IntegrityCheck::EncryptedDigest(v) => {
                    #[allow(clippy::needless_borrow)]
                    #[allow(clippy::needless_borrows_for_generic_args)]
                    struct_ser.serialize_field("encryptedDigest", pbjson::private::base64::encode(&v).as_str())?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for file_pointer::LocatorInfo {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "key",
            "size",
            "transitCdnKey",
            "transitCdnNumber",
            "transitTierUploadTimestamp",
            "mediaTierCdnNumber",
            "localKey",
            "plaintextHash",
            "encryptedDigest",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Key,
            Size,
            TransitCdnKey,
            TransitCdnNumber,
            TransitTierUploadTimestamp,
            MediaTierCdnNumber,
            LocalKey,
            PlaintextHash,
            EncryptedDigest,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "key" => Ok(GeneratedField::Key),
                            "size" => Ok(GeneratedField::Size),
                            "transitCdnKey" => Ok(GeneratedField::TransitCdnKey),
                            "transitCdnNumber" => Ok(GeneratedField::TransitCdnNumber),
                            "transitTierUploadTimestamp" => Ok(GeneratedField::TransitTierUploadTimestamp),
                            "mediaTierCdnNumber" => Ok(GeneratedField::MediaTierCdnNumber),
                            "localKey" => Ok(GeneratedField::LocalKey),
                            "plaintextHash" => Ok(GeneratedField::PlaintextHash),
                            "encryptedDigest" => Ok(GeneratedField::EncryptedDigest),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = file_pointer::LocatorInfo;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.FilePointer.LocatorInfo")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<file_pointer::LocatorInfo, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut key__ = None;
                let mut size__ = None;
                let mut transit_cdn_key__ = None;
                let mut transit_cdn_number__ = None;
                let mut transit_tier_upload_timestamp__ = None;
                let mut media_tier_cdn_number__ = None;
                let mut local_key__ = None;
                let mut integrity_check__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Key => {
                            if key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("key"));
                            }
                            key__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Size => {
                            if size__.is_some() {
                                return Err(serde::de::Error::duplicate_field("size"));
                            }
                            size__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::TransitCdnKey => {
                            if transit_cdn_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("transitCdnKey"));
                            }
                            transit_cdn_key__ = map_.next_value()?;
                        }
                        GeneratedField::TransitCdnNumber => {
                            if transit_cdn_number__.is_some() {
                                return Err(serde::de::Error::duplicate_field("transitCdnNumber"));
                            }
                            transit_cdn_number__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::TransitTierUploadTimestamp => {
                            if transit_tier_upload_timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("transitTierUploadTimestamp"));
                            }
                            transit_tier_upload_timestamp__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::MediaTierCdnNumber => {
                            if media_tier_cdn_number__.is_some() {
                                return Err(serde::de::Error::duplicate_field("mediaTierCdnNumber"));
                            }
                            media_tier_cdn_number__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::LocalKey => {
                            if local_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("localKey"));
                            }
                            local_key__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::PlaintextHash => {
                            if integrity_check__.is_some() {
                                return Err(serde::de::Error::duplicate_field("plaintextHash"));
                            }
                            integrity_check__ = map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| file_pointer::locator_info::IntegrityCheck::PlaintextHash(x.0));
                        }
                        GeneratedField::EncryptedDigest => {
                            if integrity_check__.is_some() {
                                return Err(serde::de::Error::duplicate_field("encryptedDigest"));
                            }
                            integrity_check__ = map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| file_pointer::locator_info::IntegrityCheck::EncryptedDigest(x.0));
                        }
                    }
                }
                Ok(file_pointer::LocatorInfo {
                    key: key__.unwrap_or_default(),
                    size: size__.unwrap_or_default(),
                    transit_cdn_key: transit_cdn_key__,
                    transit_cdn_number: transit_cdn_number__,
                    transit_tier_upload_timestamp: transit_tier_upload_timestamp__,
                    media_tier_cdn_number: media_tier_cdn_number__,
                    local_key: local_key__,
                    integrity_check: integrity_check__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.FilePointer.LocatorInfo", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for Frame {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.item.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Frame", len)?;
        if let Some(v) = self.item.as_ref() {
            match v {
                frame::Item::Account(v) => {
                    struct_ser.serialize_field("account", v)?;
                }
                frame::Item::Recipient(v) => {
                    struct_ser.serialize_field("recipient", v)?;
                }
                frame::Item::Chat(v) => {
                    struct_ser.serialize_field("chat", v)?;
                }
                frame::Item::ChatItem(v) => {
                    struct_ser.serialize_field("chatItem", v)?;
                }
                frame::Item::StickerPack(v) => {
                    struct_ser.serialize_field("stickerPack", v)?;
                }
                frame::Item::AdHocCall(v) => {
                    struct_ser.serialize_field("adHocCall", v)?;
                }
                frame::Item::NotificationProfile(v) => {
                    struct_ser.serialize_field("notificationProfile", v)?;
                }
                frame::Item::ChatFolder(v) => {
                    struct_ser.serialize_field("chatFolder", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for Frame {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "account",
            "recipient",
            "chat",
            "chatItem",
            "stickerPack",
            "adHocCall",
            "notificationProfile",
            "chatFolder",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Account,
            Recipient,
            Chat,
            ChatItem,
            StickerPack,
            AdHocCall,
            NotificationProfile,
            ChatFolder,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "account" => Ok(GeneratedField::Account),
                            "recipient" => Ok(GeneratedField::Recipient),
                            "chat" => Ok(GeneratedField::Chat),
                            "chatItem" => Ok(GeneratedField::ChatItem),
                            "stickerPack" => Ok(GeneratedField::StickerPack),
                            "adHocCall" => Ok(GeneratedField::AdHocCall),
                            "notificationProfile" => Ok(GeneratedField::NotificationProfile),
                            "chatFolder" => Ok(GeneratedField::ChatFolder),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = Frame;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Frame")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Frame, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut item__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Account => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("account"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(frame::Item::Account)
;
                        }
                        GeneratedField::Recipient => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("recipient"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(frame::Item::Recipient)
;
                        }
                        GeneratedField::Chat => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("chat"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(frame::Item::Chat)
;
                        }
                        GeneratedField::ChatItem => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("chatItem"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(frame::Item::ChatItem)
;
                        }
                        GeneratedField::StickerPack => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("stickerPack"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(frame::Item::StickerPack)
;
                        }
                        GeneratedField::AdHocCall => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("adHocCall"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(frame::Item::AdHocCall)
;
                        }
                        GeneratedField::NotificationProfile => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("notificationProfile"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(frame::Item::NotificationProfile)
;
                        }
                        GeneratedField::ChatFolder => {
                            if item__.is_some() {
                                return Err(serde::de::Error::duplicate_field("chatFolder"));
                            }
                            item__ = map_.next_value::<::std::option::Option<_>>()?.map(frame::Item::ChatFolder)
;
                        }
                    }
                }
                Ok(Frame {
                    item: item__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Frame", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GenericGroupUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GenericGroupUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GenericGroupUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GenericGroupUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GenericGroupUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GenericGroupUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(GenericGroupUpdate {
                    updater_aci: updater_aci__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GenericGroupUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GiftBadge {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.receipt_credential_presentation.is_empty() {
            len += 1;
        }
        if self.state != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GiftBadge", len)?;
        if !self.receipt_credential_presentation.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("receiptCredentialPresentation", pbjson::private::base64::encode(&self.receipt_credential_presentation).as_str())?;
        }
        if self.state != 0 {
            let v = gift_badge::State::try_from(self.state)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.state)))?;
            struct_ser.serialize_field("state", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GiftBadge {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "receiptCredentialPresentation",
            "state",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            ReceiptCredentialPresentation,
            State,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "receiptCredentialPresentation" => Ok(GeneratedField::ReceiptCredentialPresentation),
                            "state" => Ok(GeneratedField::State),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GiftBadge;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GiftBadge")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GiftBadge, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut receipt_credential_presentation__ = None;
                let mut state__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::ReceiptCredentialPresentation => {
                            if receipt_credential_presentation__.is_some() {
                                return Err(serde::de::Error::duplicate_field("receiptCredentialPresentation"));
                            }
                            receipt_credential_presentation__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::State => {
                            if state__.is_some() {
                                return Err(serde::de::Error::duplicate_field("state"));
                            }
                            state__ = Some(map_.next_value::<gift_badge::State>()? as i32);
                        }
                    }
                }
                Ok(GiftBadge {
                    receipt_credential_presentation: receipt_credential_presentation__.unwrap_or_default(),
                    state: state__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GiftBadge", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for gift_badge::State {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unopened => "UNOPENED",
            Self::Opened => "OPENED",
            Self::Redeemed => "REDEEMED",
            Self::Failed => "FAILED",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for gift_badge::State {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNOPENED",
            "OPENED",
            "REDEEMED",
            "FAILED",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = gift_badge::State;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNOPENED" => Ok(gift_badge::State::Unopened),
                    "OPENED" => Ok(gift_badge::State::Opened),
                    "REDEEMED" => Ok(gift_badge::State::Redeemed),
                    "FAILED" => Ok(gift_badge::State::Failed),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for Group {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.master_key.is_empty() {
            len += 1;
        }
        if self.whitelisted {
            len += 1;
        }
        if self.hide_story {
            len += 1;
        }
        if self.story_send_mode != 0 {
            len += 1;
        }
        if self.snapshot.is_some() {
            len += 1;
        }
        if self.blocked {
            len += 1;
        }
        if self.avatar_color.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Group", len)?;
        if !self.master_key.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("masterKey", pbjson::private::base64::encode(&self.master_key).as_str())?;
        }
        if self.whitelisted {
            struct_ser.serialize_field("whitelisted", &self.whitelisted)?;
        }
        if self.hide_story {
            struct_ser.serialize_field("hideStory", &self.hide_story)?;
        }
        if self.story_send_mode != 0 {
            let v = group::StorySendMode::try_from(self.story_send_mode)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.story_send_mode)))?;
            struct_ser.serialize_field("storySendMode", &v)?;
        }
        if let Some(v) = self.snapshot.as_ref() {
            struct_ser.serialize_field("snapshot", v)?;
        }
        if self.blocked {
            struct_ser.serialize_field("blocked", &self.blocked)?;
        }
        if let Some(v) = self.avatar_color.as_ref() {
            let v = AvatarColor::try_from(*v)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?;
            struct_ser.serialize_field("avatarColor", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for Group {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "masterKey",
            "whitelisted",
            "hideStory",
            "storySendMode",
            "snapshot",
            "blocked",
            "avatarColor",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            MasterKey,
            Whitelisted,
            HideStory,
            StorySendMode,
            Snapshot,
            Blocked,
            AvatarColor,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "masterKey" => Ok(GeneratedField::MasterKey),
                            "whitelisted" => Ok(GeneratedField::Whitelisted),
                            "hideStory" => Ok(GeneratedField::HideStory),
                            "storySendMode" => Ok(GeneratedField::StorySendMode),
                            "snapshot" => Ok(GeneratedField::Snapshot),
                            "blocked" => Ok(GeneratedField::Blocked),
                            "avatarColor" => Ok(GeneratedField::AvatarColor),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = Group;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Group")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Group, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut master_key__ = None;
                let mut whitelisted__ = None;
                let mut hide_story__ = None;
                let mut story_send_mode__ = None;
                let mut snapshot__ = None;
                let mut blocked__ = None;
                let mut avatar_color__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::MasterKey => {
                            if master_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("masterKey"));
                            }
                            master_key__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Whitelisted => {
                            if whitelisted__.is_some() {
                                return Err(serde::de::Error::duplicate_field("whitelisted"));
                            }
                            whitelisted__ = Some(map_.next_value()?);
                        }
                        GeneratedField::HideStory => {
                            if hide_story__.is_some() {
                                return Err(serde::de::Error::duplicate_field("hideStory"));
                            }
                            hide_story__ = Some(map_.next_value()?);
                        }
                        GeneratedField::StorySendMode => {
                            if story_send_mode__.is_some() {
                                return Err(serde::de::Error::duplicate_field("storySendMode"));
                            }
                            story_send_mode__ = Some(map_.next_value::<group::StorySendMode>()? as i32);
                        }
                        GeneratedField::Snapshot => {
                            if snapshot__.is_some() {
                                return Err(serde::de::Error::duplicate_field("snapshot"));
                            }
                            snapshot__ = map_.next_value()?;
                        }
                        GeneratedField::Blocked => {
                            if blocked__.is_some() {
                                return Err(serde::de::Error::duplicate_field("blocked"));
                            }
                            blocked__ = Some(map_.next_value()?);
                        }
                        GeneratedField::AvatarColor => {
                            if avatar_color__.is_some() {
                                return Err(serde::de::Error::duplicate_field("avatarColor"));
                            }
                            avatar_color__ = map_.next_value::<::std::option::Option<AvatarColor>>()?.map(|x| x as i32);
                        }
                    }
                }
                Ok(Group {
                    master_key: master_key__.unwrap_or_default(),
                    whitelisted: whitelisted__.unwrap_or_default(),
                    hide_story: hide_story__.unwrap_or_default(),
                    story_send_mode: story_send_mode__.unwrap_or_default(),
                    snapshot: snapshot__,
                    blocked: blocked__.unwrap_or_default(),
                    avatar_color: avatar_color__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Group", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for group::AccessControl {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.attributes != 0 {
            len += 1;
        }
        if self.members != 0 {
            len += 1;
        }
        if self.add_from_invite_link != 0 {
            len += 1;
        }
        if self.member_label != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Group.AccessControl", len)?;
        if self.attributes != 0 {
            let v = group::access_control::AccessRequired::try_from(self.attributes)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.attributes)))?;
            struct_ser.serialize_field("attributes", &v)?;
        }
        if self.members != 0 {
            let v = group::access_control::AccessRequired::try_from(self.members)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.members)))?;
            struct_ser.serialize_field("members", &v)?;
        }
        if self.add_from_invite_link != 0 {
            let v = group::access_control::AccessRequired::try_from(self.add_from_invite_link)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.add_from_invite_link)))?;
            struct_ser.serialize_field("addFromInviteLink", &v)?;
        }
        if self.member_label != 0 {
            let v = group::access_control::AccessRequired::try_from(self.member_label)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.member_label)))?;
            struct_ser.serialize_field("memberLabel", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for group::AccessControl {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "attributes",
            "members",
            "addFromInviteLink",
            "memberLabel",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Attributes,
            Members,
            AddFromInviteLink,
            MemberLabel,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "attributes" => Ok(GeneratedField::Attributes),
                            "members" => Ok(GeneratedField::Members),
                            "addFromInviteLink" => Ok(GeneratedField::AddFromInviteLink),
                            "memberLabel" => Ok(GeneratedField::MemberLabel),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = group::AccessControl;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Group.AccessControl")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<group::AccessControl, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut attributes__ = None;
                let mut members__ = None;
                let mut add_from_invite_link__ = None;
                let mut member_label__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Attributes => {
                            if attributes__.is_some() {
                                return Err(serde::de::Error::duplicate_field("attributes"));
                            }
                            attributes__ = Some(map_.next_value::<group::access_control::AccessRequired>()? as i32);
                        }
                        GeneratedField::Members => {
                            if members__.is_some() {
                                return Err(serde::de::Error::duplicate_field("members"));
                            }
                            members__ = Some(map_.next_value::<group::access_control::AccessRequired>()? as i32);
                        }
                        GeneratedField::AddFromInviteLink => {
                            if add_from_invite_link__.is_some() {
                                return Err(serde::de::Error::duplicate_field("addFromInviteLink"));
                            }
                            add_from_invite_link__ = Some(map_.next_value::<group::access_control::AccessRequired>()? as i32);
                        }
                        GeneratedField::MemberLabel => {
                            if member_label__.is_some() {
                                return Err(serde::de::Error::duplicate_field("memberLabel"));
                            }
                            member_label__ = Some(map_.next_value::<group::access_control::AccessRequired>()? as i32);
                        }
                    }
                }
                Ok(group::AccessControl {
                    attributes: attributes__.unwrap_or_default(),
                    members: members__.unwrap_or_default(),
                    add_from_invite_link: add_from_invite_link__.unwrap_or_default(),
                    member_label: member_label__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Group.AccessControl", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for group::access_control::AccessRequired {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::Any => "ANY",
            Self::Member => "MEMBER",
            Self::Administrator => "ADMINISTRATOR",
            Self::Unsatisfiable => "UNSATISFIABLE",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for group::access_control::AccessRequired {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "ANY",
            "MEMBER",
            "ADMINISTRATOR",
            "UNSATISFIABLE",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = group::access_control::AccessRequired;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(group::access_control::AccessRequired::Unknown),
                    "ANY" => Ok(group::access_control::AccessRequired::Any),
                    "MEMBER" => Ok(group::access_control::AccessRequired::Member),
                    "ADMINISTRATOR" => Ok(group::access_control::AccessRequired::Administrator),
                    "UNSATISFIABLE" => Ok(group::access_control::AccessRequired::Unsatisfiable),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for group::GroupAttributeBlob {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.content.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Group.GroupAttributeBlob", len)?;
        if let Some(v) = self.content.as_ref() {
            match v {
                group::group_attribute_blob::Content::Title(v) => {
                    struct_ser.serialize_field("title", v)?;
                }
                group::group_attribute_blob::Content::Avatar(v) => {
                    #[allow(clippy::needless_borrow)]
                    #[allow(clippy::needless_borrows_for_generic_args)]
                    struct_ser.serialize_field("avatar", pbjson::private::base64::encode(&v).as_str())?;
                }
                group::group_attribute_blob::Content::DisappearingMessagesDuration(v) => {
                    struct_ser.serialize_field("disappearingMessagesDuration", v)?;
                }
                group::group_attribute_blob::Content::DescriptionText(v) => {
                    struct_ser.serialize_field("descriptionText", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for group::GroupAttributeBlob {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "title",
            "avatar",
            "disappearingMessagesDuration",
            "descriptionText",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Title,
            Avatar,
            DisappearingMessagesDuration,
            DescriptionText,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "title" => Ok(GeneratedField::Title),
                            "avatar" => Ok(GeneratedField::Avatar),
                            "disappearingMessagesDuration" => Ok(GeneratedField::DisappearingMessagesDuration),
                            "descriptionText" => Ok(GeneratedField::DescriptionText),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = group::GroupAttributeBlob;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Group.GroupAttributeBlob")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<group::GroupAttributeBlob, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut content__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Title => {
                            if content__.is_some() {
                                return Err(serde::de::Error::duplicate_field("title"));
                            }
                            content__ = map_.next_value::<::std::option::Option<_>>()?.map(group::group_attribute_blob::Content::Title);
                        }
                        GeneratedField::Avatar => {
                            if content__.is_some() {
                                return Err(serde::de::Error::duplicate_field("avatar"));
                            }
                            content__ = map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| group::group_attribute_blob::Content::Avatar(x.0));
                        }
                        GeneratedField::DisappearingMessagesDuration => {
                            if content__.is_some() {
                                return Err(serde::de::Error::duplicate_field("disappearingMessagesDuration"));
                            }
                            content__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| group::group_attribute_blob::Content::DisappearingMessagesDuration(x.0));
                        }
                        GeneratedField::DescriptionText => {
                            if content__.is_some() {
                                return Err(serde::de::Error::duplicate_field("descriptionText"));
                            }
                            content__ = map_.next_value::<::std::option::Option<_>>()?.map(group::group_attribute_blob::Content::DescriptionText);
                        }
                    }
                }
                Ok(group::GroupAttributeBlob {
                    content: content__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Group.GroupAttributeBlob", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for group::GroupSnapshot {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.title.is_some() {
            len += 1;
        }
        if self.description.is_some() {
            len += 1;
        }
        if !self.avatar_url.is_empty() {
            len += 1;
        }
        if self.disappearing_messages_timer.is_some() {
            len += 1;
        }
        if self.access_control.is_some() {
            len += 1;
        }
        if self.version != 0 {
            len += 1;
        }
        if !self.members.is_empty() {
            len += 1;
        }
        if !self.members_pending_profile_key.is_empty() {
            len += 1;
        }
        if !self.members_pending_admin_approval.is_empty() {
            len += 1;
        }
        if !self.invite_link_password.is_empty() {
            len += 1;
        }
        if self.announcements_only {
            len += 1;
        }
        if !self.members_banned.is_empty() {
            len += 1;
        }
        if self.terminated {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Group.GroupSnapshot", len)?;
        if let Some(v) = self.title.as_ref() {
            struct_ser.serialize_field("title", v)?;
        }
        if let Some(v) = self.description.as_ref() {
            struct_ser.serialize_field("description", v)?;
        }
        if !self.avatar_url.is_empty() {
            struct_ser.serialize_field("avatarUrl", &self.avatar_url)?;
        }
        if let Some(v) = self.disappearing_messages_timer.as_ref() {
            struct_ser.serialize_field("disappearingMessagesTimer", v)?;
        }
        if let Some(v) = self.access_control.as_ref() {
            struct_ser.serialize_field("accessControl", v)?;
        }
        if self.version != 0 {
            struct_ser.serialize_field("version", &self.version)?;
        }
        if !self.members.is_empty() {
            struct_ser.serialize_field("members", &self.members)?;
        }
        if !self.members_pending_profile_key.is_empty() {
            struct_ser.serialize_field("membersPendingProfileKey", &self.members_pending_profile_key)?;
        }
        if !self.members_pending_admin_approval.is_empty() {
            struct_ser.serialize_field("membersPendingAdminApproval", &self.members_pending_admin_approval)?;
        }
        if !self.invite_link_password.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("inviteLinkPassword", pbjson::private::base64::encode(&self.invite_link_password).as_str())?;
        }
        if self.announcements_only {
            struct_ser.serialize_field("announcementsOnly", &self.announcements_only)?;
        }
        if !self.members_banned.is_empty() {
            struct_ser.serialize_field("membersBanned", &self.members_banned)?;
        }
        if self.terminated {
            struct_ser.serialize_field("terminated", &self.terminated)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for group::GroupSnapshot {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "title",
            "description",
            "avatarUrl",
            "disappearingMessagesTimer",
            "accessControl",
            "version",
            "members",
            "membersPendingProfileKey",
            "membersPendingAdminApproval",
            "inviteLinkPassword",
            "announcementsOnly",
            "membersBanned",
            "terminated",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Title,
            Description,
            AvatarUrl,
            DisappearingMessagesTimer,
            AccessControl,
            Version,
            Members,
            MembersPendingProfileKey,
            MembersPendingAdminApproval,
            InviteLinkPassword,
            AnnouncementsOnly,
            MembersBanned,
            Terminated,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "title" => Ok(GeneratedField::Title),
                            "description" => Ok(GeneratedField::Description),
                            "avatarUrl" => Ok(GeneratedField::AvatarUrl),
                            "disappearingMessagesTimer" => Ok(GeneratedField::DisappearingMessagesTimer),
                            "accessControl" => Ok(GeneratedField::AccessControl),
                            "version" => Ok(GeneratedField::Version),
                            "members" => Ok(GeneratedField::Members),
                            "membersPendingProfileKey" => Ok(GeneratedField::MembersPendingProfileKey),
                            "membersPendingAdminApproval" => Ok(GeneratedField::MembersPendingAdminApproval),
                            "inviteLinkPassword" => Ok(GeneratedField::InviteLinkPassword),
                            "announcementsOnly" => Ok(GeneratedField::AnnouncementsOnly),
                            "membersBanned" => Ok(GeneratedField::MembersBanned),
                            "terminated" => Ok(GeneratedField::Terminated),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = group::GroupSnapshot;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Group.GroupSnapshot")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<group::GroupSnapshot, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut title__ = None;
                let mut description__ = None;
                let mut avatar_url__ = None;
                let mut disappearing_messages_timer__ = None;
                let mut access_control__ = None;
                let mut version__ = None;
                let mut members__ = None;
                let mut members_pending_profile_key__ = None;
                let mut members_pending_admin_approval__ = None;
                let mut invite_link_password__ = None;
                let mut announcements_only__ = None;
                let mut members_banned__ = None;
                let mut terminated__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Title => {
                            if title__.is_some() {
                                return Err(serde::de::Error::duplicate_field("title"));
                            }
                            title__ = map_.next_value()?;
                        }
                        GeneratedField::Description => {
                            if description__.is_some() {
                                return Err(serde::de::Error::duplicate_field("description"));
                            }
                            description__ = map_.next_value()?;
                        }
                        GeneratedField::AvatarUrl => {
                            if avatar_url__.is_some() {
                                return Err(serde::de::Error::duplicate_field("avatarUrl"));
                            }
                            avatar_url__ = Some(map_.next_value()?);
                        }
                        GeneratedField::DisappearingMessagesTimer => {
                            if disappearing_messages_timer__.is_some() {
                                return Err(serde::de::Error::duplicate_field("disappearingMessagesTimer"));
                            }
                            disappearing_messages_timer__ = map_.next_value()?;
                        }
                        GeneratedField::AccessControl => {
                            if access_control__.is_some() {
                                return Err(serde::de::Error::duplicate_field("accessControl"));
                            }
                            access_control__ = map_.next_value()?;
                        }
                        GeneratedField::Version => {
                            if version__.is_some() {
                                return Err(serde::de::Error::duplicate_field("version"));
                            }
                            version__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Members => {
                            if members__.is_some() {
                                return Err(serde::de::Error::duplicate_field("members"));
                            }
                            members__ = Some(map_.next_value()?);
                        }
                        GeneratedField::MembersPendingProfileKey => {
                            if members_pending_profile_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("membersPendingProfileKey"));
                            }
                            members_pending_profile_key__ = Some(map_.next_value()?);
                        }
                        GeneratedField::MembersPendingAdminApproval => {
                            if members_pending_admin_approval__.is_some() {
                                return Err(serde::de::Error::duplicate_field("membersPendingAdminApproval"));
                            }
                            members_pending_admin_approval__ = Some(map_.next_value()?);
                        }
                        GeneratedField::InviteLinkPassword => {
                            if invite_link_password__.is_some() {
                                return Err(serde::de::Error::duplicate_field("inviteLinkPassword"));
                            }
                            invite_link_password__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::AnnouncementsOnly => {
                            if announcements_only__.is_some() {
                                return Err(serde::de::Error::duplicate_field("announcementsOnly"));
                            }
                            announcements_only__ = Some(map_.next_value()?);
                        }
                        GeneratedField::MembersBanned => {
                            if members_banned__.is_some() {
                                return Err(serde::de::Error::duplicate_field("membersBanned"));
                            }
                            members_banned__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Terminated => {
                            if terminated__.is_some() {
                                return Err(serde::de::Error::duplicate_field("terminated"));
                            }
                            terminated__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(group::GroupSnapshot {
                    title: title__,
                    description: description__,
                    avatar_url: avatar_url__.unwrap_or_default(),
                    disappearing_messages_timer: disappearing_messages_timer__,
                    access_control: access_control__,
                    version: version__.unwrap_or_default(),
                    members: members__.unwrap_or_default(),
                    members_pending_profile_key: members_pending_profile_key__.unwrap_or_default(),
                    members_pending_admin_approval: members_pending_admin_approval__.unwrap_or_default(),
                    invite_link_password: invite_link_password__.unwrap_or_default(),
                    announcements_only: announcements_only__.unwrap_or_default(),
                    members_banned: members_banned__.unwrap_or_default(),
                    terminated: terminated__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Group.GroupSnapshot", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for group::Member {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.user_id.is_empty() {
            len += 1;
        }
        if self.role != 0 {
            len += 1;
        }
        if self.joined_at_version != 0 {
            len += 1;
        }
        if !self.label_emoji.is_empty() {
            len += 1;
        }
        if !self.label_string.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Group.Member", len)?;
        if !self.user_id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("userId", pbjson::private::base64::encode(&self.user_id).as_str())?;
        }
        if self.role != 0 {
            let v = group::member::Role::try_from(self.role)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.role)))?;
            struct_ser.serialize_field("role", &v)?;
        }
        if self.joined_at_version != 0 {
            struct_ser.serialize_field("joinedAtVersion", &self.joined_at_version)?;
        }
        if !self.label_emoji.is_empty() {
            struct_ser.serialize_field("labelEmoji", &self.label_emoji)?;
        }
        if !self.label_string.is_empty() {
            struct_ser.serialize_field("labelString", &self.label_string)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for group::Member {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "userId",
            "role",
            "joinedAtVersion",
            "labelEmoji",
            "labelString",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UserId,
            Role,
            JoinedAtVersion,
            LabelEmoji,
            LabelString,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "userId" => Ok(GeneratedField::UserId),
                            "role" => Ok(GeneratedField::Role),
                            "joinedAtVersion" => Ok(GeneratedField::JoinedAtVersion),
                            "labelEmoji" => Ok(GeneratedField::LabelEmoji),
                            "labelString" => Ok(GeneratedField::LabelString),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = group::Member;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Group.Member")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<group::Member, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut user_id__ = None;
                let mut role__ = None;
                let mut joined_at_version__ = None;
                let mut label_emoji__ = None;
                let mut label_string__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UserId => {
                            if user_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("userId"));
                            }
                            user_id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Role => {
                            if role__.is_some() {
                                return Err(serde::de::Error::duplicate_field("role"));
                            }
                            role__ = Some(map_.next_value::<group::member::Role>()? as i32);
                        }
                        GeneratedField::JoinedAtVersion => {
                            if joined_at_version__.is_some() {
                                return Err(serde::de::Error::duplicate_field("joinedAtVersion"));
                            }
                            joined_at_version__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::LabelEmoji => {
                            if label_emoji__.is_some() {
                                return Err(serde::de::Error::duplicate_field("labelEmoji"));
                            }
                            label_emoji__ = Some(map_.next_value()?);
                        }
                        GeneratedField::LabelString => {
                            if label_string__.is_some() {
                                return Err(serde::de::Error::duplicate_field("labelString"));
                            }
                            label_string__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(group::Member {
                    user_id: user_id__.unwrap_or_default(),
                    role: role__.unwrap_or_default(),
                    joined_at_version: joined_at_version__.unwrap_or_default(),
                    label_emoji: label_emoji__.unwrap_or_default(),
                    label_string: label_string__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Group.Member", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for group::member::Role {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::Default => "DEFAULT",
            Self::Administrator => "ADMINISTRATOR",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for group::member::Role {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "DEFAULT",
            "ADMINISTRATOR",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = group::member::Role;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(group::member::Role::Unknown),
                    "DEFAULT" => Ok(group::member::Role::Default),
                    "ADMINISTRATOR" => Ok(group::member::Role::Administrator),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for group::MemberBanned {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.user_id.is_empty() {
            len += 1;
        }
        if self.timestamp != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Group.MemberBanned", len)?;
        if !self.user_id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("userId", pbjson::private::base64::encode(&self.user_id).as_str())?;
        }
        if self.timestamp != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for group::MemberBanned {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "userId",
            "timestamp",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UserId,
            Timestamp,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "userId" => Ok(GeneratedField::UserId),
                            "timestamp" => Ok(GeneratedField::Timestamp),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = group::MemberBanned;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Group.MemberBanned")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<group::MemberBanned, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut user_id__ = None;
                let mut timestamp__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UserId => {
                            if user_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("userId"));
                            }
                            user_id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Timestamp => {
                            if timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("timestamp"));
                            }
                            timestamp__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(group::MemberBanned {
                    user_id: user_id__.unwrap_or_default(),
                    timestamp: timestamp__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Group.MemberBanned", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for group::MemberPendingAdminApproval {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.user_id.is_empty() {
            len += 1;
        }
        if self.timestamp != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Group.MemberPendingAdminApproval", len)?;
        if !self.user_id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("userId", pbjson::private::base64::encode(&self.user_id).as_str())?;
        }
        if self.timestamp != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for group::MemberPendingAdminApproval {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "userId",
            "timestamp",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UserId,
            Timestamp,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "userId" => Ok(GeneratedField::UserId),
                            "timestamp" => Ok(GeneratedField::Timestamp),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = group::MemberPendingAdminApproval;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Group.MemberPendingAdminApproval")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<group::MemberPendingAdminApproval, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut user_id__ = None;
                let mut timestamp__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UserId => {
                            if user_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("userId"));
                            }
                            user_id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Timestamp => {
                            if timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("timestamp"));
                            }
                            timestamp__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(group::MemberPendingAdminApproval {
                    user_id: user_id__.unwrap_or_default(),
                    timestamp: timestamp__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Group.MemberPendingAdminApproval", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for group::MemberPendingProfileKey {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.member.is_some() {
            len += 1;
        }
        if !self.added_by_user_id.is_empty() {
            len += 1;
        }
        if self.timestamp != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Group.MemberPendingProfileKey", len)?;
        if let Some(v) = self.member.as_ref() {
            struct_ser.serialize_field("member", v)?;
        }
        if !self.added_by_user_id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("addedByUserId", pbjson::private::base64::encode(&self.added_by_user_id).as_str())?;
        }
        if self.timestamp != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for group::MemberPendingProfileKey {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "member",
            "addedByUserId",
            "timestamp",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Member,
            AddedByUserId,
            Timestamp,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "member" => Ok(GeneratedField::Member),
                            "addedByUserId" => Ok(GeneratedField::AddedByUserId),
                            "timestamp" => Ok(GeneratedField::Timestamp),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = group::MemberPendingProfileKey;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Group.MemberPendingProfileKey")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<group::MemberPendingProfileKey, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut member__ = None;
                let mut added_by_user_id__ = None;
                let mut timestamp__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Member => {
                            if member__.is_some() {
                                return Err(serde::de::Error::duplicate_field("member"));
                            }
                            member__ = map_.next_value()?;
                        }
                        GeneratedField::AddedByUserId => {
                            if added_by_user_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("addedByUserId"));
                            }
                            added_by_user_id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Timestamp => {
                            if timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("timestamp"));
                            }
                            timestamp__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(group::MemberPendingProfileKey {
                    member: member__,
                    added_by_user_id: added_by_user_id__.unwrap_or_default(),
                    timestamp: timestamp__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Group.MemberPendingProfileKey", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for group::StorySendMode {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Default => "DEFAULT",
            Self::Disabled => "DISABLED",
            Self::Enabled => "ENABLED",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for group::StorySendMode {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "DEFAULT",
            "DISABLED",
            "ENABLED",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = group::StorySendMode;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "DEFAULT" => Ok(group::StorySendMode::Default),
                    "DISABLED" => Ok(group::StorySendMode::Disabled),
                    "ENABLED" => Ok(group::StorySendMode::Enabled),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for GroupAdminStatusUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        if !self.member_aci.is_empty() {
            len += 1;
        }
        if self.was_admin_status_granted {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupAdminStatusUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if !self.member_aci.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("memberAci", pbjson::private::base64::encode(&self.member_aci).as_str())?;
        }
        if self.was_admin_status_granted {
            struct_ser.serialize_field("wasAdminStatusGranted", &self.was_admin_status_granted)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupAdminStatusUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
            "memberAci",
            "wasAdminStatusGranted",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
            MemberAci,
            WasAdminStatusGranted,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "memberAci" => Ok(GeneratedField::MemberAci),
                            "wasAdminStatusGranted" => Ok(GeneratedField::WasAdminStatusGranted),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupAdminStatusUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupAdminStatusUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupAdminStatusUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                let mut member_aci__ = None;
                let mut was_admin_status_granted__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::MemberAci => {
                            if member_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("memberAci"));
                            }
                            member_aci__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::WasAdminStatusGranted => {
                            if was_admin_status_granted__.is_some() {
                                return Err(serde::de::Error::duplicate_field("wasAdminStatusGranted"));
                            }
                            was_admin_status_granted__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(GroupAdminStatusUpdate {
                    updater_aci: updater_aci__,
                    member_aci: member_aci__.unwrap_or_default(),
                    was_admin_status_granted: was_admin_status_granted__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupAdminStatusUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupAnnouncementOnlyChangeUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        if self.is_announcement_only {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupAnnouncementOnlyChangeUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if self.is_announcement_only {
            struct_ser.serialize_field("isAnnouncementOnly", &self.is_announcement_only)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupAnnouncementOnlyChangeUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
            "isAnnouncementOnly",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
            IsAnnouncementOnly,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "isAnnouncementOnly" => Ok(GeneratedField::IsAnnouncementOnly),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupAnnouncementOnlyChangeUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupAnnouncementOnlyChangeUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupAnnouncementOnlyChangeUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                let mut is_announcement_only__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::IsAnnouncementOnly => {
                            if is_announcement_only__.is_some() {
                                return Err(serde::de::Error::duplicate_field("isAnnouncementOnly"));
                            }
                            is_announcement_only__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(GroupAnnouncementOnlyChangeUpdate {
                    updater_aci: updater_aci__,
                    is_announcement_only: is_announcement_only__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupAnnouncementOnlyChangeUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupAttributesAccessLevelChangeUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        if self.access_level != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupAttributesAccessLevelChangeUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if self.access_level != 0 {
            let v = GroupV2AccessLevel::try_from(self.access_level)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.access_level)))?;
            struct_ser.serialize_field("accessLevel", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupAttributesAccessLevelChangeUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
            "accessLevel",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
            AccessLevel,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "accessLevel" => Ok(GeneratedField::AccessLevel),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupAttributesAccessLevelChangeUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupAttributesAccessLevelChangeUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupAttributesAccessLevelChangeUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                let mut access_level__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::AccessLevel => {
                            if access_level__.is_some() {
                                return Err(serde::de::Error::duplicate_field("accessLevel"));
                            }
                            access_level__ = Some(map_.next_value::<GroupV2AccessLevel>()? as i32);
                        }
                    }
                }
                Ok(GroupAttributesAccessLevelChangeUpdate {
                    updater_aci: updater_aci__,
                    access_level: access_level__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupAttributesAccessLevelChangeUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupAvatarUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        if self.was_removed {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupAvatarUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if self.was_removed {
            struct_ser.serialize_field("wasRemoved", &self.was_removed)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupAvatarUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
            "wasRemoved",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
            WasRemoved,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "wasRemoved" => Ok(GeneratedField::WasRemoved),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupAvatarUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupAvatarUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupAvatarUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                let mut was_removed__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::WasRemoved => {
                            if was_removed__.is_some() {
                                return Err(serde::de::Error::duplicate_field("wasRemoved"));
                            }
                            was_removed__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(GroupAvatarUpdate {
                    updater_aci: updater_aci__,
                    was_removed: was_removed__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupAvatarUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupCall {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.call_id.is_some() {
            len += 1;
        }
        if self.state != 0 {
            len += 1;
        }
        if self.ringer_recipient_id.is_some() {
            len += 1;
        }
        if self.started_call_recipient_id.is_some() {
            len += 1;
        }
        if self.started_call_timestamp != 0 {
            len += 1;
        }
        if self.ended_call_timestamp.is_some() {
            len += 1;
        }
        if self.read {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupCall", len)?;
        if let Some(v) = self.call_id.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("callId", ToString::to_string(&v).as_str())?;
        }
        if self.state != 0 {
            let v = group_call::State::try_from(self.state)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.state)))?;
            struct_ser.serialize_field("state", &v)?;
        }
        if let Some(v) = self.ringer_recipient_id.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("ringerRecipientId", ToString::to_string(&v).as_str())?;
        }
        if let Some(v) = self.started_call_recipient_id.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("startedCallRecipientId", ToString::to_string(&v).as_str())?;
        }
        if self.started_call_timestamp != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("startedCallTimestamp", ToString::to_string(&self.started_call_timestamp).as_str())?;
        }
        if let Some(v) = self.ended_call_timestamp.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("endedCallTimestamp", ToString::to_string(&v).as_str())?;
        }
        if self.read {
            struct_ser.serialize_field("read", &self.read)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupCall {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "callId",
            "state",
            "ringerRecipientId",
            "startedCallRecipientId",
            "startedCallTimestamp",
            "endedCallTimestamp",
            "read",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            CallId,
            State,
            RingerRecipientId,
            StartedCallRecipientId,
            StartedCallTimestamp,
            EndedCallTimestamp,
            Read,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "callId" => Ok(GeneratedField::CallId),
                            "state" => Ok(GeneratedField::State),
                            "ringerRecipientId" => Ok(GeneratedField::RingerRecipientId),
                            "startedCallRecipientId" => Ok(GeneratedField::StartedCallRecipientId),
                            "startedCallTimestamp" => Ok(GeneratedField::StartedCallTimestamp),
                            "endedCallTimestamp" => Ok(GeneratedField::EndedCallTimestamp),
                            "read" => Ok(GeneratedField::Read),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupCall;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupCall")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupCall, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut call_id__ = None;
                let mut state__ = None;
                let mut ringer_recipient_id__ = None;
                let mut started_call_recipient_id__ = None;
                let mut started_call_timestamp__ = None;
                let mut ended_call_timestamp__ = None;
                let mut read__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::CallId => {
                            if call_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("callId"));
                            }
                            call_id__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::State => {
                            if state__.is_some() {
                                return Err(serde::de::Error::duplicate_field("state"));
                            }
                            state__ = Some(map_.next_value::<group_call::State>()? as i32);
                        }
                        GeneratedField::RingerRecipientId => {
                            if ringer_recipient_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("ringerRecipientId"));
                            }
                            ringer_recipient_id__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::StartedCallRecipientId => {
                            if started_call_recipient_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("startedCallRecipientId"));
                            }
                            started_call_recipient_id__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::StartedCallTimestamp => {
                            if started_call_timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("startedCallTimestamp"));
                            }
                            started_call_timestamp__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::EndedCallTimestamp => {
                            if ended_call_timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("endedCallTimestamp"));
                            }
                            ended_call_timestamp__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Read => {
                            if read__.is_some() {
                                return Err(serde::de::Error::duplicate_field("read"));
                            }
                            read__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(GroupCall {
                    call_id: call_id__,
                    state: state__.unwrap_or_default(),
                    ringer_recipient_id: ringer_recipient_id__,
                    started_call_recipient_id: started_call_recipient_id__,
                    started_call_timestamp: started_call_timestamp__.unwrap_or_default(),
                    ended_call_timestamp: ended_call_timestamp__,
                    read: read__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupCall", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for group_call::State {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::UnknownState => "UNKNOWN_STATE",
            Self::Generic => "GENERIC",
            Self::Joined => "JOINED",
            Self::Ringing => "RINGING",
            Self::Accepted => "ACCEPTED",
            Self::Declined => "DECLINED",
            Self::Missed => "MISSED",
            Self::MissedNotificationProfile => "MISSED_NOTIFICATION_PROFILE",
            Self::OutgoingRing => "OUTGOING_RING",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for group_call::State {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN_STATE",
            "GENERIC",
            "JOINED",
            "RINGING",
            "ACCEPTED",
            "DECLINED",
            "MISSED",
            "MISSED_NOTIFICATION_PROFILE",
            "OUTGOING_RING",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = group_call::State;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN_STATE" => Ok(group_call::State::UnknownState),
                    "GENERIC" => Ok(group_call::State::Generic),
                    "JOINED" => Ok(group_call::State::Joined),
                    "RINGING" => Ok(group_call::State::Ringing),
                    "ACCEPTED" => Ok(group_call::State::Accepted),
                    "DECLINED" => Ok(group_call::State::Declined),
                    "MISSED" => Ok(group_call::State::Missed),
                    "MISSED_NOTIFICATION_PROFILE" => Ok(group_call::State::MissedNotificationProfile),
                    "OUTGOING_RING" => Ok(group_call::State::OutgoingRing),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for GroupChangeChatUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.updates.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupChangeChatUpdate", len)?;
        if !self.updates.is_empty() {
            struct_ser.serialize_field("updates", &self.updates)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupChangeChatUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updates",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Updates,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updates" => Ok(GeneratedField::Updates),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupChangeChatUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupChangeChatUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupChangeChatUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updates__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Updates => {
                            if updates__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updates"));
                            }
                            updates__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(GroupChangeChatUpdate {
                    updates: updates__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupChangeChatUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for group_change_chat_update::Update {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.update.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupChangeChatUpdate.Update", len)?;
        if let Some(v) = self.update.as_ref() {
            match v {
                group_change_chat_update::update::Update::GenericGroupUpdate(v) => {
                    struct_ser.serialize_field("genericGroupUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupCreationUpdate(v) => {
                    struct_ser.serialize_field("groupCreationUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupNameUpdate(v) => {
                    struct_ser.serialize_field("groupNameUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupAvatarUpdate(v) => {
                    struct_ser.serialize_field("groupAvatarUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupDescriptionUpdate(v) => {
                    struct_ser.serialize_field("groupDescriptionUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupMembershipAccessLevelChangeUpdate(v) => {
                    struct_ser.serialize_field("groupMembershipAccessLevelChangeUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupAttributesAccessLevelChangeUpdate(v) => {
                    struct_ser.serialize_field("groupAttributesAccessLevelChangeUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupAnnouncementOnlyChangeUpdate(v) => {
                    struct_ser.serialize_field("groupAnnouncementOnlyChangeUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupAdminStatusUpdate(v) => {
                    struct_ser.serialize_field("groupAdminStatusUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupMemberLeftUpdate(v) => {
                    struct_ser.serialize_field("groupMemberLeftUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupMemberRemovedUpdate(v) => {
                    struct_ser.serialize_field("groupMemberRemovedUpdate", v)?;
                }
                group_change_chat_update::update::Update::SelfInvitedToGroupUpdate(v) => {
                    struct_ser.serialize_field("selfInvitedToGroupUpdate", v)?;
                }
                group_change_chat_update::update::Update::SelfInvitedOtherUserToGroupUpdate(v) => {
                    struct_ser.serialize_field("selfInvitedOtherUserToGroupUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupUnknownInviteeUpdate(v) => {
                    struct_ser.serialize_field("groupUnknownInviteeUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupInvitationAcceptedUpdate(v) => {
                    struct_ser.serialize_field("groupInvitationAcceptedUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupInvitationDeclinedUpdate(v) => {
                    struct_ser.serialize_field("groupInvitationDeclinedUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupMemberJoinedUpdate(v) => {
                    struct_ser.serialize_field("groupMemberJoinedUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupMemberAddedUpdate(v) => {
                    struct_ser.serialize_field("groupMemberAddedUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupSelfInvitationRevokedUpdate(v) => {
                    struct_ser.serialize_field("groupSelfInvitationRevokedUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupInvitationRevokedUpdate(v) => {
                    struct_ser.serialize_field("groupInvitationRevokedUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupJoinRequestUpdate(v) => {
                    struct_ser.serialize_field("groupJoinRequestUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupJoinRequestApprovalUpdate(v) => {
                    struct_ser.serialize_field("groupJoinRequestApprovalUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupJoinRequestCanceledUpdate(v) => {
                    struct_ser.serialize_field("groupJoinRequestCanceledUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupInviteLinkResetUpdate(v) => {
                    struct_ser.serialize_field("groupInviteLinkResetUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupInviteLinkEnabledUpdate(v) => {
                    struct_ser.serialize_field("groupInviteLinkEnabledUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupInviteLinkAdminApprovalUpdate(v) => {
                    struct_ser.serialize_field("groupInviteLinkAdminApprovalUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupInviteLinkDisabledUpdate(v) => {
                    struct_ser.serialize_field("groupInviteLinkDisabledUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupMemberJoinedByLinkUpdate(v) => {
                    struct_ser.serialize_field("groupMemberJoinedByLinkUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupV2MigrationUpdate(v) => {
                    struct_ser.serialize_field("groupV2MigrationUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupV2MigrationSelfInvitedUpdate(v) => {
                    struct_ser.serialize_field("groupV2MigrationSelfInvitedUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupV2MigrationInvitedMembersUpdate(v) => {
                    struct_ser.serialize_field("groupV2MigrationInvitedMembersUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupV2MigrationDroppedMembersUpdate(v) => {
                    struct_ser.serialize_field("groupV2MigrationDroppedMembersUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupSequenceOfRequestsAndCancelsUpdate(v) => {
                    struct_ser.serialize_field("groupSequenceOfRequestsAndCancelsUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupExpirationTimerUpdate(v) => {
                    struct_ser.serialize_field("groupExpirationTimerUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupMemberLabelAccessLevelChangeUpdate(v) => {
                    struct_ser.serialize_field("groupMemberLabelAccessLevelChangeUpdate", v)?;
                }
                group_change_chat_update::update::Update::GroupTerminateChangeUpdate(v) => {
                    struct_ser.serialize_field("groupTerminateChangeUpdate", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for group_change_chat_update::Update {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "genericGroupUpdate",
            "groupCreationUpdate",
            "groupNameUpdate",
            "groupAvatarUpdate",
            "groupDescriptionUpdate",
            "groupMembershipAccessLevelChangeUpdate",
            "groupAttributesAccessLevelChangeUpdate",
            "groupAnnouncementOnlyChangeUpdate",
            "groupAdminStatusUpdate",
            "groupMemberLeftUpdate",
            "groupMemberRemovedUpdate",
            "selfInvitedToGroupUpdate",
            "selfInvitedOtherUserToGroupUpdate",
            "groupUnknownInviteeUpdate",
            "groupInvitationAcceptedUpdate",
            "groupInvitationDeclinedUpdate",
            "groupMemberJoinedUpdate",
            "groupMemberAddedUpdate",
            "groupSelfInvitationRevokedUpdate",
            "groupInvitationRevokedUpdate",
            "groupJoinRequestUpdate",
            "groupJoinRequestApprovalUpdate",
            "groupJoinRequestCanceledUpdate",
            "groupInviteLinkResetUpdate",
            "groupInviteLinkEnabledUpdate",
            "groupInviteLinkAdminApprovalUpdate",
            "groupInviteLinkDisabledUpdate",
            "groupMemberJoinedByLinkUpdate",
            "groupV2MigrationUpdate",
            "groupV2MigrationSelfInvitedUpdate",
            "groupV2MigrationInvitedMembersUpdate",
            "groupV2MigrationDroppedMembersUpdate",
            "groupSequenceOfRequestsAndCancelsUpdate",
            "groupExpirationTimerUpdate",
            "groupMemberLabelAccessLevelChangeUpdate",
            "groupTerminateChangeUpdate",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            GenericGroupUpdate,
            GroupCreationUpdate,
            GroupNameUpdate,
            GroupAvatarUpdate,
            GroupDescriptionUpdate,
            GroupMembershipAccessLevelChangeUpdate,
            GroupAttributesAccessLevelChangeUpdate,
            GroupAnnouncementOnlyChangeUpdate,
            GroupAdminStatusUpdate,
            GroupMemberLeftUpdate,
            GroupMemberRemovedUpdate,
            SelfInvitedToGroupUpdate,
            SelfInvitedOtherUserToGroupUpdate,
            GroupUnknownInviteeUpdate,
            GroupInvitationAcceptedUpdate,
            GroupInvitationDeclinedUpdate,
            GroupMemberJoinedUpdate,
            GroupMemberAddedUpdate,
            GroupSelfInvitationRevokedUpdate,
            GroupInvitationRevokedUpdate,
            GroupJoinRequestUpdate,
            GroupJoinRequestApprovalUpdate,
            GroupJoinRequestCanceledUpdate,
            GroupInviteLinkResetUpdate,
            GroupInviteLinkEnabledUpdate,
            GroupInviteLinkAdminApprovalUpdate,
            GroupInviteLinkDisabledUpdate,
            GroupMemberJoinedByLinkUpdate,
            GroupV2MigrationUpdate,
            GroupV2MigrationSelfInvitedUpdate,
            GroupV2MigrationInvitedMembersUpdate,
            GroupV2MigrationDroppedMembersUpdate,
            GroupSequenceOfRequestsAndCancelsUpdate,
            GroupExpirationTimerUpdate,
            GroupMemberLabelAccessLevelChangeUpdate,
            GroupTerminateChangeUpdate,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "genericGroupUpdate" => Ok(GeneratedField::GenericGroupUpdate),
                            "groupCreationUpdate" => Ok(GeneratedField::GroupCreationUpdate),
                            "groupNameUpdate" => Ok(GeneratedField::GroupNameUpdate),
                            "groupAvatarUpdate" => Ok(GeneratedField::GroupAvatarUpdate),
                            "groupDescriptionUpdate" => Ok(GeneratedField::GroupDescriptionUpdate),
                            "groupMembershipAccessLevelChangeUpdate" => Ok(GeneratedField::GroupMembershipAccessLevelChangeUpdate),
                            "groupAttributesAccessLevelChangeUpdate" => Ok(GeneratedField::GroupAttributesAccessLevelChangeUpdate),
                            "groupAnnouncementOnlyChangeUpdate" => Ok(GeneratedField::GroupAnnouncementOnlyChangeUpdate),
                            "groupAdminStatusUpdate" => Ok(GeneratedField::GroupAdminStatusUpdate),
                            "groupMemberLeftUpdate" => Ok(GeneratedField::GroupMemberLeftUpdate),
                            "groupMemberRemovedUpdate" => Ok(GeneratedField::GroupMemberRemovedUpdate),
                            "selfInvitedToGroupUpdate" => Ok(GeneratedField::SelfInvitedToGroupUpdate),
                            "selfInvitedOtherUserToGroupUpdate" => Ok(GeneratedField::SelfInvitedOtherUserToGroupUpdate),
                            "groupUnknownInviteeUpdate" => Ok(GeneratedField::GroupUnknownInviteeUpdate),
                            "groupInvitationAcceptedUpdate" => Ok(GeneratedField::GroupInvitationAcceptedUpdate),
                            "groupInvitationDeclinedUpdate" => Ok(GeneratedField::GroupInvitationDeclinedUpdate),
                            "groupMemberJoinedUpdate" => Ok(GeneratedField::GroupMemberJoinedUpdate),
                            "groupMemberAddedUpdate" => Ok(GeneratedField::GroupMemberAddedUpdate),
                            "groupSelfInvitationRevokedUpdate" => Ok(GeneratedField::GroupSelfInvitationRevokedUpdate),
                            "groupInvitationRevokedUpdate" => Ok(GeneratedField::GroupInvitationRevokedUpdate),
                            "groupJoinRequestUpdate" => Ok(GeneratedField::GroupJoinRequestUpdate),
                            "groupJoinRequestApprovalUpdate" => Ok(GeneratedField::GroupJoinRequestApprovalUpdate),
                            "groupJoinRequestCanceledUpdate" => Ok(GeneratedField::GroupJoinRequestCanceledUpdate),
                            "groupInviteLinkResetUpdate" => Ok(GeneratedField::GroupInviteLinkResetUpdate),
                            "groupInviteLinkEnabledUpdate" => Ok(GeneratedField::GroupInviteLinkEnabledUpdate),
                            "groupInviteLinkAdminApprovalUpdate" => Ok(GeneratedField::GroupInviteLinkAdminApprovalUpdate),
                            "groupInviteLinkDisabledUpdate" => Ok(GeneratedField::GroupInviteLinkDisabledUpdate),
                            "groupMemberJoinedByLinkUpdate" => Ok(GeneratedField::GroupMemberJoinedByLinkUpdate),
                            "groupV2MigrationUpdate" => Ok(GeneratedField::GroupV2MigrationUpdate),
                            "groupV2MigrationSelfInvitedUpdate" => Ok(GeneratedField::GroupV2MigrationSelfInvitedUpdate),
                            "groupV2MigrationInvitedMembersUpdate" => Ok(GeneratedField::GroupV2MigrationInvitedMembersUpdate),
                            "groupV2MigrationDroppedMembersUpdate" => Ok(GeneratedField::GroupV2MigrationDroppedMembersUpdate),
                            "groupSequenceOfRequestsAndCancelsUpdate" => Ok(GeneratedField::GroupSequenceOfRequestsAndCancelsUpdate),
                            "groupExpirationTimerUpdate" => Ok(GeneratedField::GroupExpirationTimerUpdate),
                            "groupMemberLabelAccessLevelChangeUpdate" => Ok(GeneratedField::GroupMemberLabelAccessLevelChangeUpdate),
                            "groupTerminateChangeUpdate" => Ok(GeneratedField::GroupTerminateChangeUpdate),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = group_change_chat_update::Update;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupChangeChatUpdate.Update")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<group_change_chat_update::Update, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut update__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::GenericGroupUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("genericGroupUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GenericGroupUpdate)
;
                        }
                        GeneratedField::GroupCreationUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupCreationUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupCreationUpdate)
;
                        }
                        GeneratedField::GroupNameUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupNameUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupNameUpdate)
;
                        }
                        GeneratedField::GroupAvatarUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupAvatarUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupAvatarUpdate)
;
                        }
                        GeneratedField::GroupDescriptionUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupDescriptionUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupDescriptionUpdate)
;
                        }
                        GeneratedField::GroupMembershipAccessLevelChangeUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupMembershipAccessLevelChangeUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupMembershipAccessLevelChangeUpdate)
;
                        }
                        GeneratedField::GroupAttributesAccessLevelChangeUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupAttributesAccessLevelChangeUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupAttributesAccessLevelChangeUpdate)
;
                        }
                        GeneratedField::GroupAnnouncementOnlyChangeUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupAnnouncementOnlyChangeUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupAnnouncementOnlyChangeUpdate)
;
                        }
                        GeneratedField::GroupAdminStatusUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupAdminStatusUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupAdminStatusUpdate)
;
                        }
                        GeneratedField::GroupMemberLeftUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupMemberLeftUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupMemberLeftUpdate)
;
                        }
                        GeneratedField::GroupMemberRemovedUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupMemberRemovedUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupMemberRemovedUpdate)
;
                        }
                        GeneratedField::SelfInvitedToGroupUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("selfInvitedToGroupUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::SelfInvitedToGroupUpdate)
;
                        }
                        GeneratedField::SelfInvitedOtherUserToGroupUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("selfInvitedOtherUserToGroupUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::SelfInvitedOtherUserToGroupUpdate)
;
                        }
                        GeneratedField::GroupUnknownInviteeUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupUnknownInviteeUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupUnknownInviteeUpdate)
;
                        }
                        GeneratedField::GroupInvitationAcceptedUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupInvitationAcceptedUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupInvitationAcceptedUpdate)
;
                        }
                        GeneratedField::GroupInvitationDeclinedUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupInvitationDeclinedUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupInvitationDeclinedUpdate)
;
                        }
                        GeneratedField::GroupMemberJoinedUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupMemberJoinedUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupMemberJoinedUpdate)
;
                        }
                        GeneratedField::GroupMemberAddedUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupMemberAddedUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupMemberAddedUpdate)
;
                        }
                        GeneratedField::GroupSelfInvitationRevokedUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupSelfInvitationRevokedUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupSelfInvitationRevokedUpdate)
;
                        }
                        GeneratedField::GroupInvitationRevokedUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupInvitationRevokedUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupInvitationRevokedUpdate)
;
                        }
                        GeneratedField::GroupJoinRequestUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupJoinRequestUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupJoinRequestUpdate)
;
                        }
                        GeneratedField::GroupJoinRequestApprovalUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupJoinRequestApprovalUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupJoinRequestApprovalUpdate)
;
                        }
                        GeneratedField::GroupJoinRequestCanceledUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupJoinRequestCanceledUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupJoinRequestCanceledUpdate)
;
                        }
                        GeneratedField::GroupInviteLinkResetUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupInviteLinkResetUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupInviteLinkResetUpdate)
;
                        }
                        GeneratedField::GroupInviteLinkEnabledUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupInviteLinkEnabledUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupInviteLinkEnabledUpdate)
;
                        }
                        GeneratedField::GroupInviteLinkAdminApprovalUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupInviteLinkAdminApprovalUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupInviteLinkAdminApprovalUpdate)
;
                        }
                        GeneratedField::GroupInviteLinkDisabledUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupInviteLinkDisabledUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupInviteLinkDisabledUpdate)
;
                        }
                        GeneratedField::GroupMemberJoinedByLinkUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupMemberJoinedByLinkUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupMemberJoinedByLinkUpdate)
;
                        }
                        GeneratedField::GroupV2MigrationUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupV2MigrationUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupV2MigrationUpdate)
;
                        }
                        GeneratedField::GroupV2MigrationSelfInvitedUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupV2MigrationSelfInvitedUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupV2MigrationSelfInvitedUpdate)
;
                        }
                        GeneratedField::GroupV2MigrationInvitedMembersUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupV2MigrationInvitedMembersUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupV2MigrationInvitedMembersUpdate)
;
                        }
                        GeneratedField::GroupV2MigrationDroppedMembersUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupV2MigrationDroppedMembersUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupV2MigrationDroppedMembersUpdate)
;
                        }
                        GeneratedField::GroupSequenceOfRequestsAndCancelsUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupSequenceOfRequestsAndCancelsUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupSequenceOfRequestsAndCancelsUpdate)
;
                        }
                        GeneratedField::GroupExpirationTimerUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupExpirationTimerUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupExpirationTimerUpdate)
;
                        }
                        GeneratedField::GroupMemberLabelAccessLevelChangeUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupMemberLabelAccessLevelChangeUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupMemberLabelAccessLevelChangeUpdate)
;
                        }
                        GeneratedField::GroupTerminateChangeUpdate => {
                            if update__.is_some() {
                                return Err(serde::de::Error::duplicate_field("groupTerminateChangeUpdate"));
                            }
                            update__ = map_.next_value::<::std::option::Option<_>>()?.map(group_change_chat_update::update::Update::GroupTerminateChangeUpdate)
;
                        }
                    }
                }
                Ok(group_change_chat_update::Update {
                    update: update__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupChangeChatUpdate.Update", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupCreationUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupCreationUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupCreationUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupCreationUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupCreationUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupCreationUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(GroupCreationUpdate {
                    updater_aci: updater_aci__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupCreationUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupDescriptionUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        if self.new_description.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupDescriptionUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if let Some(v) = self.new_description.as_ref() {
            struct_ser.serialize_field("newDescription", v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupDescriptionUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
            "newDescription",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
            NewDescription,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "newDescription" => Ok(GeneratedField::NewDescription),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupDescriptionUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupDescriptionUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupDescriptionUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                let mut new_description__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::NewDescription => {
                            if new_description__.is_some() {
                                return Err(serde::de::Error::duplicate_field("newDescription"));
                            }
                            new_description__ = map_.next_value()?;
                        }
                    }
                }
                Ok(GroupDescriptionUpdate {
                    updater_aci: updater_aci__,
                    new_description: new_description__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupDescriptionUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupExpirationTimerUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.expires_in_ms != 0 {
            len += 1;
        }
        if self.updater_aci.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupExpirationTimerUpdate", len)?;
        if self.expires_in_ms != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("expiresInMs", ToString::to_string(&self.expires_in_ms).as_str())?;
        }
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupExpirationTimerUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "expiresInMs",
            "updaterAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            ExpiresInMs,
            UpdaterAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "expiresInMs" => Ok(GeneratedField::ExpiresInMs),
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupExpirationTimerUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupExpirationTimerUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupExpirationTimerUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut expires_in_ms__ = None;
                let mut updater_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::ExpiresInMs => {
                            if expires_in_ms__.is_some() {
                                return Err(serde::de::Error::duplicate_field("expiresInMs"));
                            }
                            expires_in_ms__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(GroupExpirationTimerUpdate {
                    expires_in_ms: expires_in_ms__.unwrap_or_default(),
                    updater_aci: updater_aci__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupExpirationTimerUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupInvitationAcceptedUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.inviter_aci.is_some() {
            len += 1;
        }
        if !self.new_member_aci.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupInvitationAcceptedUpdate", len)?;
        if let Some(v) = self.inviter_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("inviterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if !self.new_member_aci.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("newMemberAci", pbjson::private::base64::encode(&self.new_member_aci).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupInvitationAcceptedUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "inviterAci",
            "newMemberAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            InviterAci,
            NewMemberAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "inviterAci" => Ok(GeneratedField::InviterAci),
                            "newMemberAci" => Ok(GeneratedField::NewMemberAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupInvitationAcceptedUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupInvitationAcceptedUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupInvitationAcceptedUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut inviter_aci__ = None;
                let mut new_member_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::InviterAci => {
                            if inviter_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("inviterAci"));
                            }
                            inviter_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::NewMemberAci => {
                            if new_member_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("newMemberAci"));
                            }
                            new_member_aci__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(GroupInvitationAcceptedUpdate {
                    inviter_aci: inviter_aci__,
                    new_member_aci: new_member_aci__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupInvitationAcceptedUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupInvitationDeclinedUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.inviter_aci.is_some() {
            len += 1;
        }
        if self.invitee_aci.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupInvitationDeclinedUpdate", len)?;
        if let Some(v) = self.inviter_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("inviterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if let Some(v) = self.invitee_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("inviteeAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupInvitationDeclinedUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "inviterAci",
            "inviteeAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            InviterAci,
            InviteeAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "inviterAci" => Ok(GeneratedField::InviterAci),
                            "inviteeAci" => Ok(GeneratedField::InviteeAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupInvitationDeclinedUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupInvitationDeclinedUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupInvitationDeclinedUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut inviter_aci__ = None;
                let mut invitee_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::InviterAci => {
                            if inviter_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("inviterAci"));
                            }
                            inviter_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::InviteeAci => {
                            if invitee_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("inviteeAci"));
                            }
                            invitee_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(GroupInvitationDeclinedUpdate {
                    inviter_aci: inviter_aci__,
                    invitee_aci: invitee_aci__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupInvitationDeclinedUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupInvitationRevokedUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        if !self.invitees.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupInvitationRevokedUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if !self.invitees.is_empty() {
            struct_ser.serialize_field("invitees", &self.invitees)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupInvitationRevokedUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
            "invitees",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
            Invitees,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "invitees" => Ok(GeneratedField::Invitees),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupInvitationRevokedUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupInvitationRevokedUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupInvitationRevokedUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                let mut invitees__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Invitees => {
                            if invitees__.is_some() {
                                return Err(serde::de::Error::duplicate_field("invitees"));
                            }
                            invitees__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(GroupInvitationRevokedUpdate {
                    updater_aci: updater_aci__,
                    invitees: invitees__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupInvitationRevokedUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for group_invitation_revoked_update::Invitee {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.inviter_aci.is_some() {
            len += 1;
        }
        if self.invitee_aci.is_some() {
            len += 1;
        }
        if self.invitee_pni.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupInvitationRevokedUpdate.Invitee", len)?;
        if let Some(v) = self.inviter_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("inviterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if let Some(v) = self.invitee_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("inviteeAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if let Some(v) = self.invitee_pni.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("inviteePni", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for group_invitation_revoked_update::Invitee {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "inviterAci",
            "inviteeAci",
            "inviteePni",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            InviterAci,
            InviteeAci,
            InviteePni,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "inviterAci" => Ok(GeneratedField::InviterAci),
                            "inviteeAci" => Ok(GeneratedField::InviteeAci),
                            "inviteePni" => Ok(GeneratedField::InviteePni),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = group_invitation_revoked_update::Invitee;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupInvitationRevokedUpdate.Invitee")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<group_invitation_revoked_update::Invitee, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut inviter_aci__ = None;
                let mut invitee_aci__ = None;
                let mut invitee_pni__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::InviterAci => {
                            if inviter_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("inviterAci"));
                            }
                            inviter_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::InviteeAci => {
                            if invitee_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("inviteeAci"));
                            }
                            invitee_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::InviteePni => {
                            if invitee_pni__.is_some() {
                                return Err(serde::de::Error::duplicate_field("inviteePni"));
                            }
                            invitee_pni__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(group_invitation_revoked_update::Invitee {
                    inviter_aci: inviter_aci__,
                    invitee_aci: invitee_aci__,
                    invitee_pni: invitee_pni__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupInvitationRevokedUpdate.Invitee", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupInviteLinkAdminApprovalUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        if self.link_requires_admin_approval {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupInviteLinkAdminApprovalUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if self.link_requires_admin_approval {
            struct_ser.serialize_field("linkRequiresAdminApproval", &self.link_requires_admin_approval)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupInviteLinkAdminApprovalUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
            "linkRequiresAdminApproval",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
            LinkRequiresAdminApproval,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "linkRequiresAdminApproval" => Ok(GeneratedField::LinkRequiresAdminApproval),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupInviteLinkAdminApprovalUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupInviteLinkAdminApprovalUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupInviteLinkAdminApprovalUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                let mut link_requires_admin_approval__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::LinkRequiresAdminApproval => {
                            if link_requires_admin_approval__.is_some() {
                                return Err(serde::de::Error::duplicate_field("linkRequiresAdminApproval"));
                            }
                            link_requires_admin_approval__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(GroupInviteLinkAdminApprovalUpdate {
                    updater_aci: updater_aci__,
                    link_requires_admin_approval: link_requires_admin_approval__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupInviteLinkAdminApprovalUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupInviteLinkDisabledUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupInviteLinkDisabledUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupInviteLinkDisabledUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupInviteLinkDisabledUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupInviteLinkDisabledUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupInviteLinkDisabledUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(GroupInviteLinkDisabledUpdate {
                    updater_aci: updater_aci__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupInviteLinkDisabledUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupInviteLinkEnabledUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        if self.link_requires_admin_approval {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupInviteLinkEnabledUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if self.link_requires_admin_approval {
            struct_ser.serialize_field("linkRequiresAdminApproval", &self.link_requires_admin_approval)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupInviteLinkEnabledUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
            "linkRequiresAdminApproval",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
            LinkRequiresAdminApproval,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "linkRequiresAdminApproval" => Ok(GeneratedField::LinkRequiresAdminApproval),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupInviteLinkEnabledUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupInviteLinkEnabledUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupInviteLinkEnabledUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                let mut link_requires_admin_approval__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::LinkRequiresAdminApproval => {
                            if link_requires_admin_approval__.is_some() {
                                return Err(serde::de::Error::duplicate_field("linkRequiresAdminApproval"));
                            }
                            link_requires_admin_approval__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(GroupInviteLinkEnabledUpdate {
                    updater_aci: updater_aci__,
                    link_requires_admin_approval: link_requires_admin_approval__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupInviteLinkEnabledUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupInviteLinkResetUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupInviteLinkResetUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupInviteLinkResetUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupInviteLinkResetUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupInviteLinkResetUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupInviteLinkResetUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(GroupInviteLinkResetUpdate {
                    updater_aci: updater_aci__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupInviteLinkResetUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupJoinRequestApprovalUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.requestor_aci.is_empty() {
            len += 1;
        }
        if self.updater_aci.is_some() {
            len += 1;
        }
        if self.was_approved {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupJoinRequestApprovalUpdate", len)?;
        if !self.requestor_aci.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("requestorAci", pbjson::private::base64::encode(&self.requestor_aci).as_str())?;
        }
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if self.was_approved {
            struct_ser.serialize_field("wasApproved", &self.was_approved)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupJoinRequestApprovalUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "requestorAci",
            "updaterAci",
            "wasApproved",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            RequestorAci,
            UpdaterAci,
            WasApproved,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "requestorAci" => Ok(GeneratedField::RequestorAci),
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "wasApproved" => Ok(GeneratedField::WasApproved),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupJoinRequestApprovalUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupJoinRequestApprovalUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupJoinRequestApprovalUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut requestor_aci__ = None;
                let mut updater_aci__ = None;
                let mut was_approved__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::RequestorAci => {
                            if requestor_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("requestorAci"));
                            }
                            requestor_aci__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::WasApproved => {
                            if was_approved__.is_some() {
                                return Err(serde::de::Error::duplicate_field("wasApproved"));
                            }
                            was_approved__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(GroupJoinRequestApprovalUpdate {
                    requestor_aci: requestor_aci__.unwrap_or_default(),
                    updater_aci: updater_aci__,
                    was_approved: was_approved__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupJoinRequestApprovalUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupJoinRequestCanceledUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.requestor_aci.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupJoinRequestCanceledUpdate", len)?;
        if !self.requestor_aci.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("requestorAci", pbjson::private::base64::encode(&self.requestor_aci).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupJoinRequestCanceledUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "requestorAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            RequestorAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "requestorAci" => Ok(GeneratedField::RequestorAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupJoinRequestCanceledUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupJoinRequestCanceledUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupJoinRequestCanceledUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut requestor_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::RequestorAci => {
                            if requestor_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("requestorAci"));
                            }
                            requestor_aci__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(GroupJoinRequestCanceledUpdate {
                    requestor_aci: requestor_aci__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupJoinRequestCanceledUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupJoinRequestUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.requestor_aci.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupJoinRequestUpdate", len)?;
        if !self.requestor_aci.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("requestorAci", pbjson::private::base64::encode(&self.requestor_aci).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupJoinRequestUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "requestorAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            RequestorAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "requestorAci" => Ok(GeneratedField::RequestorAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupJoinRequestUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupJoinRequestUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupJoinRequestUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut requestor_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::RequestorAci => {
                            if requestor_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("requestorAci"));
                            }
                            requestor_aci__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(GroupJoinRequestUpdate {
                    requestor_aci: requestor_aci__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupJoinRequestUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupMemberAddedUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        if !self.new_member_aci.is_empty() {
            len += 1;
        }
        if self.had_open_invitation {
            len += 1;
        }
        if self.inviter_aci.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupMemberAddedUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if !self.new_member_aci.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("newMemberAci", pbjson::private::base64::encode(&self.new_member_aci).as_str())?;
        }
        if self.had_open_invitation {
            struct_ser.serialize_field("hadOpenInvitation", &self.had_open_invitation)?;
        }
        if let Some(v) = self.inviter_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("inviterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupMemberAddedUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
            "newMemberAci",
            "hadOpenInvitation",
            "inviterAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
            NewMemberAci,
            HadOpenInvitation,
            InviterAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "newMemberAci" => Ok(GeneratedField::NewMemberAci),
                            "hadOpenInvitation" => Ok(GeneratedField::HadOpenInvitation),
                            "inviterAci" => Ok(GeneratedField::InviterAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupMemberAddedUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupMemberAddedUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupMemberAddedUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                let mut new_member_aci__ = None;
                let mut had_open_invitation__ = None;
                let mut inviter_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::NewMemberAci => {
                            if new_member_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("newMemberAci"));
                            }
                            new_member_aci__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::HadOpenInvitation => {
                            if had_open_invitation__.is_some() {
                                return Err(serde::de::Error::duplicate_field("hadOpenInvitation"));
                            }
                            had_open_invitation__ = Some(map_.next_value()?);
                        }
                        GeneratedField::InviterAci => {
                            if inviter_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("inviterAci"));
                            }
                            inviter_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(GroupMemberAddedUpdate {
                    updater_aci: updater_aci__,
                    new_member_aci: new_member_aci__.unwrap_or_default(),
                    had_open_invitation: had_open_invitation__.unwrap_or_default(),
                    inviter_aci: inviter_aci__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupMemberAddedUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupMemberJoinedByLinkUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.new_member_aci.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupMemberJoinedByLinkUpdate", len)?;
        if !self.new_member_aci.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("newMemberAci", pbjson::private::base64::encode(&self.new_member_aci).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupMemberJoinedByLinkUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "newMemberAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            NewMemberAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "newMemberAci" => Ok(GeneratedField::NewMemberAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupMemberJoinedByLinkUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupMemberJoinedByLinkUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupMemberJoinedByLinkUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut new_member_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::NewMemberAci => {
                            if new_member_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("newMemberAci"));
                            }
                            new_member_aci__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(GroupMemberJoinedByLinkUpdate {
                    new_member_aci: new_member_aci__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupMemberJoinedByLinkUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupMemberJoinedUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.new_member_aci.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupMemberJoinedUpdate", len)?;
        if !self.new_member_aci.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("newMemberAci", pbjson::private::base64::encode(&self.new_member_aci).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupMemberJoinedUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "newMemberAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            NewMemberAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "newMemberAci" => Ok(GeneratedField::NewMemberAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupMemberJoinedUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupMemberJoinedUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupMemberJoinedUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut new_member_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::NewMemberAci => {
                            if new_member_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("newMemberAci"));
                            }
                            new_member_aci__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(GroupMemberJoinedUpdate {
                    new_member_aci: new_member_aci__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupMemberJoinedUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupMemberLabelAccessLevelChangeUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        if self.access_level != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupMemberLabelAccessLevelChangeUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if self.access_level != 0 {
            let v = GroupV2AccessLevel::try_from(self.access_level)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.access_level)))?;
            struct_ser.serialize_field("accessLevel", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupMemberLabelAccessLevelChangeUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
            "accessLevel",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
            AccessLevel,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "accessLevel" => Ok(GeneratedField::AccessLevel),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupMemberLabelAccessLevelChangeUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupMemberLabelAccessLevelChangeUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupMemberLabelAccessLevelChangeUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                let mut access_level__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::AccessLevel => {
                            if access_level__.is_some() {
                                return Err(serde::de::Error::duplicate_field("accessLevel"));
                            }
                            access_level__ = Some(map_.next_value::<GroupV2AccessLevel>()? as i32);
                        }
                    }
                }
                Ok(GroupMemberLabelAccessLevelChangeUpdate {
                    updater_aci: updater_aci__,
                    access_level: access_level__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupMemberLabelAccessLevelChangeUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupMemberLeftUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.aci.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupMemberLeftUpdate", len)?;
        if !self.aci.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("aci", pbjson::private::base64::encode(&self.aci).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupMemberLeftUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "aci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Aci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "aci" => Ok(GeneratedField::Aci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupMemberLeftUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupMemberLeftUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupMemberLeftUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Aci => {
                            if aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("aci"));
                            }
                            aci__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(GroupMemberLeftUpdate {
                    aci: aci__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupMemberLeftUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupMemberRemovedUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.remover_aci.is_some() {
            len += 1;
        }
        if !self.removed_aci.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupMemberRemovedUpdate", len)?;
        if let Some(v) = self.remover_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("removerAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if !self.removed_aci.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("removedAci", pbjson::private::base64::encode(&self.removed_aci).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupMemberRemovedUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "removerAci",
            "removedAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            RemoverAci,
            RemovedAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "removerAci" => Ok(GeneratedField::RemoverAci),
                            "removedAci" => Ok(GeneratedField::RemovedAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupMemberRemovedUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupMemberRemovedUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupMemberRemovedUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut remover_aci__ = None;
                let mut removed_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::RemoverAci => {
                            if remover_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("removerAci"));
                            }
                            remover_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::RemovedAci => {
                            if removed_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("removedAci"));
                            }
                            removed_aci__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(GroupMemberRemovedUpdate {
                    remover_aci: remover_aci__,
                    removed_aci: removed_aci__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupMemberRemovedUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupMembershipAccessLevelChangeUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        if self.access_level != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupMembershipAccessLevelChangeUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if self.access_level != 0 {
            let v = GroupV2AccessLevel::try_from(self.access_level)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.access_level)))?;
            struct_ser.serialize_field("accessLevel", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupMembershipAccessLevelChangeUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
            "accessLevel",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
            AccessLevel,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "accessLevel" => Ok(GeneratedField::AccessLevel),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupMembershipAccessLevelChangeUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupMembershipAccessLevelChangeUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupMembershipAccessLevelChangeUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                let mut access_level__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::AccessLevel => {
                            if access_level__.is_some() {
                                return Err(serde::de::Error::duplicate_field("accessLevel"));
                            }
                            access_level__ = Some(map_.next_value::<GroupV2AccessLevel>()? as i32);
                        }
                    }
                }
                Ok(GroupMembershipAccessLevelChangeUpdate {
                    updater_aci: updater_aci__,
                    access_level: access_level__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupMembershipAccessLevelChangeUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupNameUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        if self.new_group_name.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupNameUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if let Some(v) = self.new_group_name.as_ref() {
            struct_ser.serialize_field("newGroupName", v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupNameUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
            "newGroupName",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
            NewGroupName,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            "newGroupName" => Ok(GeneratedField::NewGroupName),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupNameUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupNameUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupNameUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                let mut new_group_name__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::NewGroupName => {
                            if new_group_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("newGroupName"));
                            }
                            new_group_name__ = map_.next_value()?;
                        }
                    }
                }
                Ok(GroupNameUpdate {
                    updater_aci: updater_aci__,
                    new_group_name: new_group_name__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupNameUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupSelfInvitationRevokedUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.revoker_aci.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupSelfInvitationRevokedUpdate", len)?;
        if let Some(v) = self.revoker_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("revokerAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupSelfInvitationRevokedUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "revokerAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            RevokerAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "revokerAci" => Ok(GeneratedField::RevokerAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupSelfInvitationRevokedUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupSelfInvitationRevokedUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupSelfInvitationRevokedUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut revoker_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::RevokerAci => {
                            if revoker_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("revokerAci"));
                            }
                            revoker_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(GroupSelfInvitationRevokedUpdate {
                    revoker_aci: revoker_aci__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupSelfInvitationRevokedUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupSequenceOfRequestsAndCancelsUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.requestor_aci.is_empty() {
            len += 1;
        }
        if self.count != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupSequenceOfRequestsAndCancelsUpdate", len)?;
        if !self.requestor_aci.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("requestorAci", pbjson::private::base64::encode(&self.requestor_aci).as_str())?;
        }
        if self.count != 0 {
            struct_ser.serialize_field("count", &self.count)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupSequenceOfRequestsAndCancelsUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "requestorAci",
            "count",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            RequestorAci,
            Count,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "requestorAci" => Ok(GeneratedField::RequestorAci),
                            "count" => Ok(GeneratedField::Count),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupSequenceOfRequestsAndCancelsUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupSequenceOfRequestsAndCancelsUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupSequenceOfRequestsAndCancelsUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut requestor_aci__ = None;
                let mut count__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::RequestorAci => {
                            if requestor_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("requestorAci"));
                            }
                            requestor_aci__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Count => {
                            if count__.is_some() {
                                return Err(serde::de::Error::duplicate_field("count"));
                            }
                            count__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(GroupSequenceOfRequestsAndCancelsUpdate {
                    requestor_aci: requestor_aci__.unwrap_or_default(),
                    count: count__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupSequenceOfRequestsAndCancelsUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupTerminateChangeUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.updater_aci.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupTerminateChangeUpdate", len)?;
        if let Some(v) = self.updater_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("updaterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupTerminateChangeUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "updaterAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            UpdaterAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "updaterAci" => Ok(GeneratedField::UpdaterAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupTerminateChangeUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupTerminateChangeUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupTerminateChangeUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut updater_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::UpdaterAci => {
                            if updater_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("updaterAci"));
                            }
                            updater_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(GroupTerminateChangeUpdate {
                    updater_aci: updater_aci__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupTerminateChangeUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupUnknownInviteeUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.inviter_aci.is_some() {
            len += 1;
        }
        if self.invitee_count != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupUnknownInviteeUpdate", len)?;
        if let Some(v) = self.inviter_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("inviterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        if self.invitee_count != 0 {
            struct_ser.serialize_field("inviteeCount", &self.invitee_count)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupUnknownInviteeUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "inviterAci",
            "inviteeCount",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            InviterAci,
            InviteeCount,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "inviterAci" => Ok(GeneratedField::InviterAci),
                            "inviteeCount" => Ok(GeneratedField::InviteeCount),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupUnknownInviteeUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupUnknownInviteeUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupUnknownInviteeUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut inviter_aci__ = None;
                let mut invitee_count__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::InviterAci => {
                            if inviter_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("inviterAci"));
                            }
                            inviter_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::InviteeCount => {
                            if invitee_count__.is_some() {
                                return Err(serde::de::Error::duplicate_field("inviteeCount"));
                            }
                            invitee_count__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(GroupUnknownInviteeUpdate {
                    inviter_aci: inviter_aci__,
                    invitee_count: invitee_count__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupUnknownInviteeUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupV2AccessLevel {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::Any => "ANY",
            Self::Member => "MEMBER",
            Self::Administrator => "ADMINISTRATOR",
            Self::Unsatisfiable => "UNSATISFIABLE",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for GroupV2AccessLevel {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "ANY",
            "MEMBER",
            "ADMINISTRATOR",
            "UNSATISFIABLE",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = GroupV2AccessLevel;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(GroupV2AccessLevel::Unknown),
                    "ANY" => Ok(GroupV2AccessLevel::Any),
                    "MEMBER" => Ok(GroupV2AccessLevel::Member),
                    "ADMINISTRATOR" => Ok(GroupV2AccessLevel::Administrator),
                    "UNSATISFIABLE" => Ok(GroupV2AccessLevel::Unsatisfiable),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for GroupV2MigrationDroppedMembersUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.dropped_members_count != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupV2MigrationDroppedMembersUpdate", len)?;
        if self.dropped_members_count != 0 {
            struct_ser.serialize_field("droppedMembersCount", &self.dropped_members_count)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupV2MigrationDroppedMembersUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "droppedMembersCount",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            DroppedMembersCount,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "droppedMembersCount" => Ok(GeneratedField::DroppedMembersCount),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupV2MigrationDroppedMembersUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupV2MigrationDroppedMembersUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupV2MigrationDroppedMembersUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut dropped_members_count__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::DroppedMembersCount => {
                            if dropped_members_count__.is_some() {
                                return Err(serde::de::Error::duplicate_field("droppedMembersCount"));
                            }
                            dropped_members_count__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(GroupV2MigrationDroppedMembersUpdate {
                    dropped_members_count: dropped_members_count__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupV2MigrationDroppedMembersUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupV2MigrationInvitedMembersUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.invited_members_count != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.GroupV2MigrationInvitedMembersUpdate", len)?;
        if self.invited_members_count != 0 {
            struct_ser.serialize_field("invitedMembersCount", &self.invited_members_count)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupV2MigrationInvitedMembersUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "invitedMembersCount",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            InvitedMembersCount,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "invitedMembersCount" => Ok(GeneratedField::InvitedMembersCount),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupV2MigrationInvitedMembersUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupV2MigrationInvitedMembersUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupV2MigrationInvitedMembersUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut invited_members_count__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::InvitedMembersCount => {
                            if invited_members_count__.is_some() {
                                return Err(serde::de::Error::duplicate_field("invitedMembersCount"));
                            }
                            invited_members_count__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(GroupV2MigrationInvitedMembersUpdate {
                    invited_members_count: invited_members_count__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupV2MigrationInvitedMembersUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupV2MigrationSelfInvitedUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let len = 0;
        let struct_ser = serializer.serialize_struct("signal.backup.GroupV2MigrationSelfInvitedUpdate", len)?;
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupV2MigrationSelfInvitedUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                            Err(serde::de::Error::unknown_field(value, FIELDS))
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupV2MigrationSelfInvitedUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupV2MigrationSelfInvitedUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupV2MigrationSelfInvitedUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                while map_.next_key::<GeneratedField>()?.is_some() {
                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
                }
                Ok(GroupV2MigrationSelfInvitedUpdate {
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupV2MigrationSelfInvitedUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for GroupV2MigrationUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let len = 0;
        let struct_ser = serializer.serialize_struct("signal.backup.GroupV2MigrationUpdate", len)?;
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for GroupV2MigrationUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                            Err(serde::de::Error::unknown_field(value, FIELDS))
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = GroupV2MigrationUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.GroupV2MigrationUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<GroupV2MigrationUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                while map_.next_key::<GeneratedField>()?.is_some() {
                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
                }
                Ok(GroupV2MigrationUpdate {
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.GroupV2MigrationUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for IndividualCall {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.call_id.is_some() {
            len += 1;
        }
        if self.r#type != 0 {
            len += 1;
        }
        if self.direction != 0 {
            len += 1;
        }
        if self.state != 0 {
            len += 1;
        }
        if self.started_call_timestamp != 0 {
            len += 1;
        }
        if self.read {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.IndividualCall", len)?;
        if let Some(v) = self.call_id.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("callId", ToString::to_string(&v).as_str())?;
        }
        if self.r#type != 0 {
            let v = individual_call::Type::try_from(self.r#type)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.r#type)))?;
            struct_ser.serialize_field("type", &v)?;
        }
        if self.direction != 0 {
            let v = individual_call::Direction::try_from(self.direction)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.direction)))?;
            struct_ser.serialize_field("direction", &v)?;
        }
        if self.state != 0 {
            let v = individual_call::State::try_from(self.state)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.state)))?;
            struct_ser.serialize_field("state", &v)?;
        }
        if self.started_call_timestamp != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("startedCallTimestamp", ToString::to_string(&self.started_call_timestamp).as_str())?;
        }
        if self.read {
            struct_ser.serialize_field("read", &self.read)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for IndividualCall {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "callId",
            "type",
            "direction",
            "state",
            "startedCallTimestamp",
            "read",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            CallId,
            Type,
            Direction,
            State,
            StartedCallTimestamp,
            Read,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "callId" => Ok(GeneratedField::CallId),
                            "type" => Ok(GeneratedField::Type),
                            "direction" => Ok(GeneratedField::Direction),
                            "state" => Ok(GeneratedField::State),
                            "startedCallTimestamp" => Ok(GeneratedField::StartedCallTimestamp),
                            "read" => Ok(GeneratedField::Read),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = IndividualCall;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.IndividualCall")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<IndividualCall, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut call_id__ = None;
                let mut r#type__ = None;
                let mut direction__ = None;
                let mut state__ = None;
                let mut started_call_timestamp__ = None;
                let mut read__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::CallId => {
                            if call_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("callId"));
                            }
                            call_id__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Type => {
                            if r#type__.is_some() {
                                return Err(serde::de::Error::duplicate_field("type"));
                            }
                            r#type__ = Some(map_.next_value::<individual_call::Type>()? as i32);
                        }
                        GeneratedField::Direction => {
                            if direction__.is_some() {
                                return Err(serde::de::Error::duplicate_field("direction"));
                            }
                            direction__ = Some(map_.next_value::<individual_call::Direction>()? as i32);
                        }
                        GeneratedField::State => {
                            if state__.is_some() {
                                return Err(serde::de::Error::duplicate_field("state"));
                            }
                            state__ = Some(map_.next_value::<individual_call::State>()? as i32);
                        }
                        GeneratedField::StartedCallTimestamp => {
                            if started_call_timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("startedCallTimestamp"));
                            }
                            started_call_timestamp__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Read => {
                            if read__.is_some() {
                                return Err(serde::de::Error::duplicate_field("read"));
                            }
                            read__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(IndividualCall {
                    call_id: call_id__,
                    r#type: r#type__.unwrap_or_default(),
                    direction: direction__.unwrap_or_default(),
                    state: state__.unwrap_or_default(),
                    started_call_timestamp: started_call_timestamp__.unwrap_or_default(),
                    read: read__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.IndividualCall", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for individual_call::Direction {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::UnknownDirection => "UNKNOWN_DIRECTION",
            Self::Incoming => "INCOMING",
            Self::Outgoing => "OUTGOING",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for individual_call::Direction {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN_DIRECTION",
            "INCOMING",
            "OUTGOING",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = individual_call::Direction;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN_DIRECTION" => Ok(individual_call::Direction::UnknownDirection),
                    "INCOMING" => Ok(individual_call::Direction::Incoming),
                    "OUTGOING" => Ok(individual_call::Direction::Outgoing),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for individual_call::State {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::UnknownState => "UNKNOWN_STATE",
            Self::Accepted => "ACCEPTED",
            Self::NotAccepted => "NOT_ACCEPTED",
            Self::Missed => "MISSED",
            Self::MissedNotificationProfile => "MISSED_NOTIFICATION_PROFILE",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for individual_call::State {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN_STATE",
            "ACCEPTED",
            "NOT_ACCEPTED",
            "MISSED",
            "MISSED_NOTIFICATION_PROFILE",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = individual_call::State;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN_STATE" => Ok(individual_call::State::UnknownState),
                    "ACCEPTED" => Ok(individual_call::State::Accepted),
                    "NOT_ACCEPTED" => Ok(individual_call::State::NotAccepted),
                    "MISSED" => Ok(individual_call::State::Missed),
                    "MISSED_NOTIFICATION_PROFILE" => Ok(individual_call::State::MissedNotificationProfile),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for individual_call::Type {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::UnknownType => "UNKNOWN_TYPE",
            Self::AudioCall => "AUDIO_CALL",
            Self::VideoCall => "VIDEO_CALL",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for individual_call::Type {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN_TYPE",
            "AUDIO_CALL",
            "VIDEO_CALL",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = individual_call::Type;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN_TYPE" => Ok(individual_call::Type::UnknownType),
                    "AUDIO_CALL" => Ok(individual_call::Type::AudioCall),
                    "VIDEO_CALL" => Ok(individual_call::Type::VideoCall),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for LearnedProfileChatUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.previous_name.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.LearnedProfileChatUpdate", len)?;
        if let Some(v) = self.previous_name.as_ref() {
            match v {
                learned_profile_chat_update::PreviousName::E164(v) => {
                    #[allow(clippy::needless_borrow)]
                    #[allow(clippy::needless_borrows_for_generic_args)]
                    struct_ser.serialize_field("e164", ToString::to_string(&v).as_str())?;
                }
                learned_profile_chat_update::PreviousName::Username(v) => {
                    struct_ser.serialize_field("username", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for LearnedProfileChatUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "e164",
            "username",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            E164,
            Username,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "e164" => Ok(GeneratedField::E164),
                            "username" => Ok(GeneratedField::Username),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = LearnedProfileChatUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.LearnedProfileChatUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<LearnedProfileChatUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut previous_name__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::E164 => {
                            if previous_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("e164"));
                            }
                            previous_name__ = map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| learned_profile_chat_update::PreviousName::E164(x.0));
                        }
                        GeneratedField::Username => {
                            if previous_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("username"));
                            }
                            previous_name__ = map_.next_value::<::std::option::Option<_>>()?.map(learned_profile_chat_update::PreviousName::Username);
                        }
                    }
                }
                Ok(LearnedProfileChatUpdate {
                    previous_name: previous_name__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.LearnedProfileChatUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for LinkPreview {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.url.is_empty() {
            len += 1;
        }
        if self.title.is_some() {
            len += 1;
        }
        if self.image.is_some() {
            len += 1;
        }
        if self.description.is_some() {
            len += 1;
        }
        if self.date.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.LinkPreview", len)?;
        if !self.url.is_empty() {
            struct_ser.serialize_field("url", &self.url)?;
        }
        if let Some(v) = self.title.as_ref() {
            struct_ser.serialize_field("title", v)?;
        }
        if let Some(v) = self.image.as_ref() {
            struct_ser.serialize_field("image", v)?;
        }
        if let Some(v) = self.description.as_ref() {
            struct_ser.serialize_field("description", v)?;
        }
        if let Some(v) = self.date.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("date", ToString::to_string(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for LinkPreview {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "url",
            "title",
            "image",
            "description",
            "date",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Url,
            Title,
            Image,
            Description,
            Date,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "url" => Ok(GeneratedField::Url),
                            "title" => Ok(GeneratedField::Title),
                            "image" => Ok(GeneratedField::Image),
                            "description" => Ok(GeneratedField::Description),
                            "date" => Ok(GeneratedField::Date),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = LinkPreview;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.LinkPreview")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<LinkPreview, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut url__ = None;
                let mut title__ = None;
                let mut image__ = None;
                let mut description__ = None;
                let mut date__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Url => {
                            if url__.is_some() {
                                return Err(serde::de::Error::duplicate_field("url"));
                            }
                            url__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Title => {
                            if title__.is_some() {
                                return Err(serde::de::Error::duplicate_field("title"));
                            }
                            title__ = map_.next_value()?;
                        }
                        GeneratedField::Image => {
                            if image__.is_some() {
                                return Err(serde::de::Error::duplicate_field("image"));
                            }
                            image__ = map_.next_value()?;
                        }
                        GeneratedField::Description => {
                            if description__.is_some() {
                                return Err(serde::de::Error::duplicate_field("description"));
                            }
                            description__ = map_.next_value()?;
                        }
                        GeneratedField::Date => {
                            if date__.is_some() {
                                return Err(serde::de::Error::duplicate_field("date"));
                            }
                            date__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(LinkPreview {
                    url: url__.unwrap_or_default(),
                    title: title__,
                    image: image__,
                    description: description__,
                    date: date__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.LinkPreview", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for MessageAttachment {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.pointer.is_some() {
            len += 1;
        }
        if self.flag != 0 {
            len += 1;
        }
        if self.was_downloaded {
            len += 1;
        }
        if self.client_uuid.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.MessageAttachment", len)?;
        if let Some(v) = self.pointer.as_ref() {
            struct_ser.serialize_field("pointer", v)?;
        }
        if self.flag != 0 {
            let v = message_attachment::Flag::try_from(self.flag)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.flag)))?;
            struct_ser.serialize_field("flag", &v)?;
        }
        if self.was_downloaded {
            struct_ser.serialize_field("wasDownloaded", &self.was_downloaded)?;
        }
        if let Some(v) = self.client_uuid.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("clientUuid", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for MessageAttachment {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "pointer",
            "flag",
            "wasDownloaded",
            "clientUuid",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Pointer,
            Flag,
            WasDownloaded,
            ClientUuid,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "pointer" => Ok(GeneratedField::Pointer),
                            "flag" => Ok(GeneratedField::Flag),
                            "wasDownloaded" => Ok(GeneratedField::WasDownloaded),
                            "clientUuid" => Ok(GeneratedField::ClientUuid),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = MessageAttachment;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.MessageAttachment")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<MessageAttachment, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut pointer__ = None;
                let mut flag__ = None;
                let mut was_downloaded__ = None;
                let mut client_uuid__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Pointer => {
                            if pointer__.is_some() {
                                return Err(serde::de::Error::duplicate_field("pointer"));
                            }
                            pointer__ = map_.next_value()?;
                        }
                        GeneratedField::Flag => {
                            if flag__.is_some() {
                                return Err(serde::de::Error::duplicate_field("flag"));
                            }
                            flag__ = Some(map_.next_value::<message_attachment::Flag>()? as i32);
                        }
                        GeneratedField::WasDownloaded => {
                            if was_downloaded__.is_some() {
                                return Err(serde::de::Error::duplicate_field("wasDownloaded"));
                            }
                            was_downloaded__ = Some(map_.next_value()?);
                        }
                        GeneratedField::ClientUuid => {
                            if client_uuid__.is_some() {
                                return Err(serde::de::Error::duplicate_field("clientUuid"));
                            }
                            client_uuid__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(MessageAttachment {
                    pointer: pointer__,
                    flag: flag__.unwrap_or_default(),
                    was_downloaded: was_downloaded__.unwrap_or_default(),
                    client_uuid: client_uuid__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.MessageAttachment", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for message_attachment::Flag {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::None => "NONE",
            Self::VoiceMessage => "VOICE_MESSAGE",
            Self::Borderless => "BORDERLESS",
            Self::Gif => "GIF",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for message_attachment::Flag {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "NONE",
            "VOICE_MESSAGE",
            "BORDERLESS",
            "GIF",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = message_attachment::Flag;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "NONE" => Ok(message_attachment::Flag::None),
                    "VOICE_MESSAGE" => Ok(message_attachment::Flag::VoiceMessage),
                    "BORDERLESS" => Ok(message_attachment::Flag::Borderless),
                    "GIF" => Ok(message_attachment::Flag::Gif),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for NotificationProfile {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.name.is_empty() {
            len += 1;
        }
        if self.emoji.is_some() {
            len += 1;
        }
        if self.color != 0 {
            len += 1;
        }
        if self.created_at_ms != 0 {
            len += 1;
        }
        if self.allow_all_calls {
            len += 1;
        }
        if self.allow_all_mentions {
            len += 1;
        }
        if !self.allowed_members.is_empty() {
            len += 1;
        }
        if self.schedule_enabled {
            len += 1;
        }
        if self.schedule_start_time != 0 {
            len += 1;
        }
        if self.schedule_end_time != 0 {
            len += 1;
        }
        if !self.schedule_days_enabled.is_empty() {
            len += 1;
        }
        if !self.id.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.NotificationProfile", len)?;
        if !self.name.is_empty() {
            struct_ser.serialize_field("name", &self.name)?;
        }
        if let Some(v) = self.emoji.as_ref() {
            struct_ser.serialize_field("emoji", v)?;
        }
        if self.color != 0 {
            struct_ser.serialize_field("color", &self.color)?;
        }
        if self.created_at_ms != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("createdAtMs", ToString::to_string(&self.created_at_ms).as_str())?;
        }
        if self.allow_all_calls {
            struct_ser.serialize_field("allowAllCalls", &self.allow_all_calls)?;
        }
        if self.allow_all_mentions {
            struct_ser.serialize_field("allowAllMentions", &self.allow_all_mentions)?;
        }
        if !self.allowed_members.is_empty() {
            struct_ser.serialize_field("allowedMembers", &self.allowed_members.iter().map(ToString::to_string).collect::<Vec<_>>())?;
        }
        if self.schedule_enabled {
            struct_ser.serialize_field("scheduleEnabled", &self.schedule_enabled)?;
        }
        if self.schedule_start_time != 0 {
            struct_ser.serialize_field("scheduleStartTime", &self.schedule_start_time)?;
        }
        if self.schedule_end_time != 0 {
            struct_ser.serialize_field("scheduleEndTime", &self.schedule_end_time)?;
        }
        if !self.schedule_days_enabled.is_empty() {
            let v = self.schedule_days_enabled.iter().cloned().map(|v| {
                notification_profile::DayOfWeek::try_from(v)
                    .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", v)))
                }).collect::<std::result::Result<Vec<_>, _>>()?;
            struct_ser.serialize_field("scheduleDaysEnabled", &v)?;
        }
        if !self.id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("id", pbjson::private::base64::encode(&self.id).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for NotificationProfile {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "name",
            "emoji",
            "color",
            "createdAtMs",
            "allowAllCalls",
            "allowAllMentions",
            "allowedMembers",
            "scheduleEnabled",
            "scheduleStartTime",
            "scheduleEndTime",
            "scheduleDaysEnabled",
            "id",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Name,
            Emoji,
            Color,
            CreatedAtMs,
            AllowAllCalls,
            AllowAllMentions,
            AllowedMembers,
            ScheduleEnabled,
            ScheduleStartTime,
            ScheduleEndTime,
            ScheduleDaysEnabled,
            Id,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "name" => Ok(GeneratedField::Name),
                            "emoji" => Ok(GeneratedField::Emoji),
                            "color" => Ok(GeneratedField::Color),
                            "createdAtMs" => Ok(GeneratedField::CreatedAtMs),
                            "allowAllCalls" => Ok(GeneratedField::AllowAllCalls),
                            "allowAllMentions" => Ok(GeneratedField::AllowAllMentions),
                            "allowedMembers" => Ok(GeneratedField::AllowedMembers),
                            "scheduleEnabled" => Ok(GeneratedField::ScheduleEnabled),
                            "scheduleStartTime" => Ok(GeneratedField::ScheduleStartTime),
                            "scheduleEndTime" => Ok(GeneratedField::ScheduleEndTime),
                            "scheduleDaysEnabled" => Ok(GeneratedField::ScheduleDaysEnabled),
                            "id" => Ok(GeneratedField::Id),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = NotificationProfile;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.NotificationProfile")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<NotificationProfile, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut name__ = None;
                let mut emoji__ = None;
                let mut color__ = None;
                let mut created_at_ms__ = None;
                let mut allow_all_calls__ = None;
                let mut allow_all_mentions__ = None;
                let mut allowed_members__ = None;
                let mut schedule_enabled__ = None;
                let mut schedule_start_time__ = None;
                let mut schedule_end_time__ = None;
                let mut schedule_days_enabled__ = None;
                let mut id__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Name => {
                            if name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("name"));
                            }
                            name__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Emoji => {
                            if emoji__.is_some() {
                                return Err(serde::de::Error::duplicate_field("emoji"));
                            }
                            emoji__ = map_.next_value()?;
                        }
                        GeneratedField::Color => {
                            if color__.is_some() {
                                return Err(serde::de::Error::duplicate_field("color"));
                            }
                            color__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::CreatedAtMs => {
                            if created_at_ms__.is_some() {
                                return Err(serde::de::Error::duplicate_field("createdAtMs"));
                            }
                            created_at_ms__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::AllowAllCalls => {
                            if allow_all_calls__.is_some() {
                                return Err(serde::de::Error::duplicate_field("allowAllCalls"));
                            }
                            allow_all_calls__ = Some(map_.next_value()?);
                        }
                        GeneratedField::AllowAllMentions => {
                            if allow_all_mentions__.is_some() {
                                return Err(serde::de::Error::duplicate_field("allowAllMentions"));
                            }
                            allow_all_mentions__ = Some(map_.next_value()?);
                        }
                        GeneratedField::AllowedMembers => {
                            if allowed_members__.is_some() {
                                return Err(serde::de::Error::duplicate_field("allowedMembers"));
                            }
                            allowed_members__ = 
                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
                                    .into_iter().map(|x| x.0).collect())
                            ;
                        }
                        GeneratedField::ScheduleEnabled => {
                            if schedule_enabled__.is_some() {
                                return Err(serde::de::Error::duplicate_field("scheduleEnabled"));
                            }
                            schedule_enabled__ = Some(map_.next_value()?);
                        }
                        GeneratedField::ScheduleStartTime => {
                            if schedule_start_time__.is_some() {
                                return Err(serde::de::Error::duplicate_field("scheduleStartTime"));
                            }
                            schedule_start_time__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::ScheduleEndTime => {
                            if schedule_end_time__.is_some() {
                                return Err(serde::de::Error::duplicate_field("scheduleEndTime"));
                            }
                            schedule_end_time__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::ScheduleDaysEnabled => {
                            if schedule_days_enabled__.is_some() {
                                return Err(serde::de::Error::duplicate_field("scheduleDaysEnabled"));
                            }
                            schedule_days_enabled__ = Some(map_.next_value::<Vec<notification_profile::DayOfWeek>>()?.into_iter().map(|x| x as i32).collect());
                        }
                        GeneratedField::Id => {
                            if id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("id"));
                            }
                            id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(NotificationProfile {
                    name: name__.unwrap_or_default(),
                    emoji: emoji__,
                    color: color__.unwrap_or_default(),
                    created_at_ms: created_at_ms__.unwrap_or_default(),
                    allow_all_calls: allow_all_calls__.unwrap_or_default(),
                    allow_all_mentions: allow_all_mentions__.unwrap_or_default(),
                    allowed_members: allowed_members__.unwrap_or_default(),
                    schedule_enabled: schedule_enabled__.unwrap_or_default(),
                    schedule_start_time: schedule_start_time__.unwrap_or_default(),
                    schedule_end_time: schedule_end_time__.unwrap_or_default(),
                    schedule_days_enabled: schedule_days_enabled__.unwrap_or_default(),
                    id: id__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.NotificationProfile", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for notification_profile::DayOfWeek {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::Monday => "MONDAY",
            Self::Tuesday => "TUESDAY",
            Self::Wednesday => "WEDNESDAY",
            Self::Thursday => "THURSDAY",
            Self::Friday => "FRIDAY",
            Self::Saturday => "SATURDAY",
            Self::Sunday => "SUNDAY",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for notification_profile::DayOfWeek {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "MONDAY",
            "TUESDAY",
            "WEDNESDAY",
            "THURSDAY",
            "FRIDAY",
            "SATURDAY",
            "SUNDAY",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = notification_profile::DayOfWeek;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(notification_profile::DayOfWeek::Unknown),
                    "MONDAY" => Ok(notification_profile::DayOfWeek::Monday),
                    "TUESDAY" => Ok(notification_profile::DayOfWeek::Tuesday),
                    "WEDNESDAY" => Ok(notification_profile::DayOfWeek::Wednesday),
                    "THURSDAY" => Ok(notification_profile::DayOfWeek::Thursday),
                    "FRIDAY" => Ok(notification_profile::DayOfWeek::Friday),
                    "SATURDAY" => Ok(notification_profile::DayOfWeek::Saturday),
                    "SUNDAY" => Ok(notification_profile::DayOfWeek::Sunday),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for PaymentNotification {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.amount_mob.is_some() {
            len += 1;
        }
        if self.fee_mob.is_some() {
            len += 1;
        }
        if self.note.is_some() {
            len += 1;
        }
        if self.transaction_details.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.PaymentNotification", len)?;
        if let Some(v) = self.amount_mob.as_ref() {
            struct_ser.serialize_field("amountMob", v)?;
        }
        if let Some(v) = self.fee_mob.as_ref() {
            struct_ser.serialize_field("feeMob", v)?;
        }
        if let Some(v) = self.note.as_ref() {
            struct_ser.serialize_field("note", v)?;
        }
        if let Some(v) = self.transaction_details.as_ref() {
            struct_ser.serialize_field("transactionDetails", v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for PaymentNotification {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "amountMob",
            "feeMob",
            "note",
            "transactionDetails",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            AmountMob,
            FeeMob,
            Note,
            TransactionDetails,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "amountMob" => Ok(GeneratedField::AmountMob),
                            "feeMob" => Ok(GeneratedField::FeeMob),
                            "note" => Ok(GeneratedField::Note),
                            "transactionDetails" => Ok(GeneratedField::TransactionDetails),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = PaymentNotification;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.PaymentNotification")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<PaymentNotification, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut amount_mob__ = None;
                let mut fee_mob__ = None;
                let mut note__ = None;
                let mut transaction_details__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::AmountMob => {
                            if amount_mob__.is_some() {
                                return Err(serde::de::Error::duplicate_field("amountMob"));
                            }
                            amount_mob__ = map_.next_value()?;
                        }
                        GeneratedField::FeeMob => {
                            if fee_mob__.is_some() {
                                return Err(serde::de::Error::duplicate_field("feeMob"));
                            }
                            fee_mob__ = map_.next_value()?;
                        }
                        GeneratedField::Note => {
                            if note__.is_some() {
                                return Err(serde::de::Error::duplicate_field("note"));
                            }
                            note__ = map_.next_value()?;
                        }
                        GeneratedField::TransactionDetails => {
                            if transaction_details__.is_some() {
                                return Err(serde::de::Error::duplicate_field("transactionDetails"));
                            }
                            transaction_details__ = map_.next_value()?;
                        }
                    }
                }
                Ok(PaymentNotification {
                    amount_mob: amount_mob__,
                    fee_mob: fee_mob__,
                    note: note__,
                    transaction_details: transaction_details__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.PaymentNotification", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for payment_notification::TransactionDetails {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.payment.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.PaymentNotification.TransactionDetails", len)?;
        if let Some(v) = self.payment.as_ref() {
            match v {
                payment_notification::transaction_details::Payment::Transaction(v) => {
                    struct_ser.serialize_field("transaction", v)?;
                }
                payment_notification::transaction_details::Payment::FailedTransaction(v) => {
                    struct_ser.serialize_field("failedTransaction", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for payment_notification::TransactionDetails {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "transaction",
            "failedTransaction",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Transaction,
            FailedTransaction,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "transaction" => Ok(GeneratedField::Transaction),
                            "failedTransaction" => Ok(GeneratedField::FailedTransaction),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = payment_notification::TransactionDetails;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.PaymentNotification.TransactionDetails")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<payment_notification::TransactionDetails, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut payment__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Transaction => {
                            if payment__.is_some() {
                                return Err(serde::de::Error::duplicate_field("transaction"));
                            }
                            payment__ = map_.next_value::<::std::option::Option<_>>()?.map(payment_notification::transaction_details::Payment::Transaction)
;
                        }
                        GeneratedField::FailedTransaction => {
                            if payment__.is_some() {
                                return Err(serde::de::Error::duplicate_field("failedTransaction"));
                            }
                            payment__ = map_.next_value::<::std::option::Option<_>>()?.map(payment_notification::transaction_details::Payment::FailedTransaction)
;
                        }
                    }
                }
                Ok(payment_notification::TransactionDetails {
                    payment: payment__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.PaymentNotification.TransactionDetails", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for payment_notification::transaction_details::FailedTransaction {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.reason != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.PaymentNotification.TransactionDetails.FailedTransaction", len)?;
        if self.reason != 0 {
            let v = payment_notification::transaction_details::failed_transaction::FailureReason::try_from(self.reason)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.reason)))?;
            struct_ser.serialize_field("reason", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for payment_notification::transaction_details::FailedTransaction {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "reason",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Reason,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "reason" => Ok(GeneratedField::Reason),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = payment_notification::transaction_details::FailedTransaction;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.PaymentNotification.TransactionDetails.FailedTransaction")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<payment_notification::transaction_details::FailedTransaction, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut reason__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Reason => {
                            if reason__.is_some() {
                                return Err(serde::de::Error::duplicate_field("reason"));
                            }
                            reason__ = Some(map_.next_value::<payment_notification::transaction_details::failed_transaction::FailureReason>()? as i32);
                        }
                    }
                }
                Ok(payment_notification::transaction_details::FailedTransaction {
                    reason: reason__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.PaymentNotification.TransactionDetails.FailedTransaction", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for payment_notification::transaction_details::failed_transaction::FailureReason {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Generic => "GENERIC",
            Self::Network => "NETWORK",
            Self::InsufficientFunds => "INSUFFICIENT_FUNDS",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for payment_notification::transaction_details::failed_transaction::FailureReason {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "GENERIC",
            "NETWORK",
            "INSUFFICIENT_FUNDS",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = payment_notification::transaction_details::failed_transaction::FailureReason;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "GENERIC" => Ok(payment_notification::transaction_details::failed_transaction::FailureReason::Generic),
                    "NETWORK" => Ok(payment_notification::transaction_details::failed_transaction::FailureReason::Network),
                    "INSUFFICIENT_FUNDS" => Ok(payment_notification::transaction_details::failed_transaction::FailureReason::InsufficientFunds),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for payment_notification::transaction_details::MobileCoinTxoIdentification {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.public_key.is_empty() {
            len += 1;
        }
        if !self.key_images.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.PaymentNotification.TransactionDetails.MobileCoinTxoIdentification", len)?;
        if !self.public_key.is_empty() {
            struct_ser.serialize_field("publicKey", &self.public_key.iter().map(pbjson::private::base64::encode).collect::<Vec<_>>())?;
        }
        if !self.key_images.is_empty() {
            struct_ser.serialize_field("keyImages", &self.key_images.iter().map(pbjson::private::base64::encode).collect::<Vec<_>>())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for payment_notification::transaction_details::MobileCoinTxoIdentification {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "publicKey",
            "keyImages",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            PublicKey,
            KeyImages,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "publicKey" => Ok(GeneratedField::PublicKey),
                            "keyImages" => Ok(GeneratedField::KeyImages),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = payment_notification::transaction_details::MobileCoinTxoIdentification;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.PaymentNotification.TransactionDetails.MobileCoinTxoIdentification")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<payment_notification::transaction_details::MobileCoinTxoIdentification, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut public_key__ = None;
                let mut key_images__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::PublicKey => {
                            if public_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("publicKey"));
                            }
                            public_key__ = 
                                Some(map_.next_value::<Vec<::pbjson::private::BytesDeserialize<_>>>()?
                                    .into_iter().map(|x| x.0).collect())
                            ;
                        }
                        GeneratedField::KeyImages => {
                            if key_images__.is_some() {
                                return Err(serde::de::Error::duplicate_field("keyImages"));
                            }
                            key_images__ = 
                                Some(map_.next_value::<Vec<::pbjson::private::BytesDeserialize<_>>>()?
                                    .into_iter().map(|x| x.0).collect())
                            ;
                        }
                    }
                }
                Ok(payment_notification::transaction_details::MobileCoinTxoIdentification {
                    public_key: public_key__.unwrap_or_default(),
                    key_images: key_images__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.PaymentNotification.TransactionDetails.MobileCoinTxoIdentification", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for payment_notification::transaction_details::Transaction {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.status != 0 {
            len += 1;
        }
        if self.mobile_coin_identification.is_some() {
            len += 1;
        }
        if self.timestamp.is_some() {
            len += 1;
        }
        if self.block_index.is_some() {
            len += 1;
        }
        if self.block_timestamp.is_some() {
            len += 1;
        }
        if self.transaction.is_some() {
            len += 1;
        }
        if self.receipt.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.PaymentNotification.TransactionDetails.Transaction", len)?;
        if self.status != 0 {
            let v = payment_notification::transaction_details::transaction::Status::try_from(self.status)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.status)))?;
            struct_ser.serialize_field("status", &v)?;
        }
        if let Some(v) = self.mobile_coin_identification.as_ref() {
            struct_ser.serialize_field("mobileCoinIdentification", v)?;
        }
        if let Some(v) = self.timestamp.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("timestamp", ToString::to_string(&v).as_str())?;
        }
        if let Some(v) = self.block_index.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("blockIndex", ToString::to_string(&v).as_str())?;
        }
        if let Some(v) = self.block_timestamp.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("blockTimestamp", ToString::to_string(&v).as_str())?;
        }
        if let Some(v) = self.transaction.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("transaction", pbjson::private::base64::encode(&v).as_str())?;
        }
        if let Some(v) = self.receipt.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("receipt", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for payment_notification::transaction_details::Transaction {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "status",
            "mobileCoinIdentification",
            "timestamp",
            "blockIndex",
            "blockTimestamp",
            "transaction",
            "receipt",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Status,
            MobileCoinIdentification,
            Timestamp,
            BlockIndex,
            BlockTimestamp,
            Transaction,
            Receipt,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "status" => Ok(GeneratedField::Status),
                            "mobileCoinIdentification" => Ok(GeneratedField::MobileCoinIdentification),
                            "timestamp" => Ok(GeneratedField::Timestamp),
                            "blockIndex" => Ok(GeneratedField::BlockIndex),
                            "blockTimestamp" => Ok(GeneratedField::BlockTimestamp),
                            "transaction" => Ok(GeneratedField::Transaction),
                            "receipt" => Ok(GeneratedField::Receipt),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = payment_notification::transaction_details::Transaction;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.PaymentNotification.TransactionDetails.Transaction")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<payment_notification::transaction_details::Transaction, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut status__ = None;
                let mut mobile_coin_identification__ = None;
                let mut timestamp__ = None;
                let mut block_index__ = None;
                let mut block_timestamp__ = None;
                let mut transaction__ = None;
                let mut receipt__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Status => {
                            if status__.is_some() {
                                return Err(serde::de::Error::duplicate_field("status"));
                            }
                            status__ = Some(map_.next_value::<payment_notification::transaction_details::transaction::Status>()? as i32);
                        }
                        GeneratedField::MobileCoinIdentification => {
                            if mobile_coin_identification__.is_some() {
                                return Err(serde::de::Error::duplicate_field("mobileCoinIdentification"));
                            }
                            mobile_coin_identification__ = map_.next_value()?;
                        }
                        GeneratedField::Timestamp => {
                            if timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("timestamp"));
                            }
                            timestamp__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::BlockIndex => {
                            if block_index__.is_some() {
                                return Err(serde::de::Error::duplicate_field("blockIndex"));
                            }
                            block_index__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::BlockTimestamp => {
                            if block_timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("blockTimestamp"));
                            }
                            block_timestamp__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Transaction => {
                            if transaction__.is_some() {
                                return Err(serde::de::Error::duplicate_field("transaction"));
                            }
                            transaction__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::Receipt => {
                            if receipt__.is_some() {
                                return Err(serde::de::Error::duplicate_field("receipt"));
                            }
                            receipt__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(payment_notification::transaction_details::Transaction {
                    status: status__.unwrap_or_default(),
                    mobile_coin_identification: mobile_coin_identification__,
                    timestamp: timestamp__,
                    block_index: block_index__,
                    block_timestamp: block_timestamp__,
                    transaction: transaction__,
                    receipt: receipt__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.PaymentNotification.TransactionDetails.Transaction", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for payment_notification::transaction_details::transaction::Status {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Initial => "INITIAL",
            Self::Submitted => "SUBMITTED",
            Self::Successful => "SUCCESSFUL",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for payment_notification::transaction_details::transaction::Status {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "INITIAL",
            "SUBMITTED",
            "SUCCESSFUL",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = payment_notification::transaction_details::transaction::Status;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "INITIAL" => Ok(payment_notification::transaction_details::transaction::Status::Initial),
                    "SUBMITTED" => Ok(payment_notification::transaction_details::transaction::Status::Submitted),
                    "SUCCESSFUL" => Ok(payment_notification::transaction_details::transaction::Status::Successful),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for PinMessageUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.target_sent_timestamp != 0 {
            len += 1;
        }
        if self.author_id != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.PinMessageUpdate", len)?;
        if self.target_sent_timestamp != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("targetSentTimestamp", ToString::to_string(&self.target_sent_timestamp).as_str())?;
        }
        if self.author_id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("authorId", ToString::to_string(&self.author_id).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for PinMessageUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "targetSentTimestamp",
            "authorId",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            TargetSentTimestamp,
            AuthorId,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "targetSentTimestamp" => Ok(GeneratedField::TargetSentTimestamp),
                            "authorId" => Ok(GeneratedField::AuthorId),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = PinMessageUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.PinMessageUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<PinMessageUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut target_sent_timestamp__ = None;
                let mut author_id__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::TargetSentTimestamp => {
                            if target_sent_timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("targetSentTimestamp"));
                            }
                            target_sent_timestamp__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::AuthorId => {
                            if author_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("authorId"));
                            }
                            author_id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(PinMessageUpdate {
                    target_sent_timestamp: target_sent_timestamp__.unwrap_or_default(),
                    author_id: author_id__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.PinMessageUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for Poll {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.question.is_empty() {
            len += 1;
        }
        if self.allow_multiple {
            len += 1;
        }
        if !self.options.is_empty() {
            len += 1;
        }
        if self.has_ended {
            len += 1;
        }
        if !self.reactions.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Poll", len)?;
        if !self.question.is_empty() {
            struct_ser.serialize_field("question", &self.question)?;
        }
        if self.allow_multiple {
            struct_ser.serialize_field("allowMultiple", &self.allow_multiple)?;
        }
        if !self.options.is_empty() {
            struct_ser.serialize_field("options", &self.options)?;
        }
        if self.has_ended {
            struct_ser.serialize_field("hasEnded", &self.has_ended)?;
        }
        if !self.reactions.is_empty() {
            struct_ser.serialize_field("reactions", &self.reactions)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for Poll {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "question",
            "allowMultiple",
            "options",
            "hasEnded",
            "reactions",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Question,
            AllowMultiple,
            Options,
            HasEnded,
            Reactions,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "question" => Ok(GeneratedField::Question),
                            "allowMultiple" => Ok(GeneratedField::AllowMultiple),
                            "options" => Ok(GeneratedField::Options),
                            "hasEnded" => Ok(GeneratedField::HasEnded),
                            "reactions" => Ok(GeneratedField::Reactions),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = Poll;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Poll")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Poll, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut question__ = None;
                let mut allow_multiple__ = None;
                let mut options__ = None;
                let mut has_ended__ = None;
                let mut reactions__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Question => {
                            if question__.is_some() {
                                return Err(serde::de::Error::duplicate_field("question"));
                            }
                            question__ = Some(map_.next_value()?);
                        }
                        GeneratedField::AllowMultiple => {
                            if allow_multiple__.is_some() {
                                return Err(serde::de::Error::duplicate_field("allowMultiple"));
                            }
                            allow_multiple__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Options => {
                            if options__.is_some() {
                                return Err(serde::de::Error::duplicate_field("options"));
                            }
                            options__ = Some(map_.next_value()?);
                        }
                        GeneratedField::HasEnded => {
                            if has_ended__.is_some() {
                                return Err(serde::de::Error::duplicate_field("hasEnded"));
                            }
                            has_ended__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Reactions => {
                            if reactions__.is_some() {
                                return Err(serde::de::Error::duplicate_field("reactions"));
                            }
                            reactions__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(Poll {
                    question: question__.unwrap_or_default(),
                    allow_multiple: allow_multiple__.unwrap_or_default(),
                    options: options__.unwrap_or_default(),
                    has_ended: has_ended__.unwrap_or_default(),
                    reactions: reactions__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Poll", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for poll::PollOption {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.option.is_empty() {
            len += 1;
        }
        if !self.votes.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Poll.PollOption", len)?;
        if !self.option.is_empty() {
            struct_ser.serialize_field("option", &self.option)?;
        }
        if !self.votes.is_empty() {
            struct_ser.serialize_field("votes", &self.votes)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for poll::PollOption {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "option",
            "votes",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Option,
            Votes,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "option" => Ok(GeneratedField::Option),
                            "votes" => Ok(GeneratedField::Votes),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = poll::PollOption;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Poll.PollOption")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<poll::PollOption, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut option__ = None;
                let mut votes__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Option => {
                            if option__.is_some() {
                                return Err(serde::de::Error::duplicate_field("option"));
                            }
                            option__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Votes => {
                            if votes__.is_some() {
                                return Err(serde::de::Error::duplicate_field("votes"));
                            }
                            votes__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(poll::PollOption {
                    option: option__.unwrap_or_default(),
                    votes: votes__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Poll.PollOption", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for poll::poll_option::PollVote {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.voter_id != 0 {
            len += 1;
        }
        if self.vote_count != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Poll.PollOption.PollVote", len)?;
        if self.voter_id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("voterId", ToString::to_string(&self.voter_id).as_str())?;
        }
        if self.vote_count != 0 {
            struct_ser.serialize_field("voteCount", &self.vote_count)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for poll::poll_option::PollVote {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "voterId",
            "voteCount",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            VoterId,
            VoteCount,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "voterId" => Ok(GeneratedField::VoterId),
                            "voteCount" => Ok(GeneratedField::VoteCount),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = poll::poll_option::PollVote;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Poll.PollOption.PollVote")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<poll::poll_option::PollVote, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut voter_id__ = None;
                let mut vote_count__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::VoterId => {
                            if voter_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("voterId"));
                            }
                            voter_id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::VoteCount => {
                            if vote_count__.is_some() {
                                return Err(serde::de::Error::duplicate_field("voteCount"));
                            }
                            vote_count__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(poll::poll_option::PollVote {
                    voter_id: voter_id__.unwrap_or_default(),
                    vote_count: vote_count__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Poll.PollOption.PollVote", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for PollTerminateUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.target_sent_timestamp != 0 {
            len += 1;
        }
        if !self.question.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.PollTerminateUpdate", len)?;
        if self.target_sent_timestamp != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("targetSentTimestamp", ToString::to_string(&self.target_sent_timestamp).as_str())?;
        }
        if !self.question.is_empty() {
            struct_ser.serialize_field("question", &self.question)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for PollTerminateUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "targetSentTimestamp",
            "question",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            TargetSentTimestamp,
            Question,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "targetSentTimestamp" => Ok(GeneratedField::TargetSentTimestamp),
                            "question" => Ok(GeneratedField::Question),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = PollTerminateUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.PollTerminateUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<PollTerminateUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut target_sent_timestamp__ = None;
                let mut question__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::TargetSentTimestamp => {
                            if target_sent_timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("targetSentTimestamp"));
                            }
                            target_sent_timestamp__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Question => {
                            if question__.is_some() {
                                return Err(serde::de::Error::duplicate_field("question"));
                            }
                            question__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(PollTerminateUpdate {
                    target_sent_timestamp: target_sent_timestamp__.unwrap_or_default(),
                    question: question__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.PollTerminateUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for ProfileChangeChatUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.previous_name.is_empty() {
            len += 1;
        }
        if !self.new_name.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ProfileChangeChatUpdate", len)?;
        if !self.previous_name.is_empty() {
            struct_ser.serialize_field("previousName", &self.previous_name)?;
        }
        if !self.new_name.is_empty() {
            struct_ser.serialize_field("newName", &self.new_name)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ProfileChangeChatUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "previousName",
            "newName",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            PreviousName,
            NewName,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "previousName" => Ok(GeneratedField::PreviousName),
                            "newName" => Ok(GeneratedField::NewName),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ProfileChangeChatUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ProfileChangeChatUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ProfileChangeChatUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut previous_name__ = None;
                let mut new_name__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::PreviousName => {
                            if previous_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("previousName"));
                            }
                            previous_name__ = Some(map_.next_value()?);
                        }
                        GeneratedField::NewName => {
                            if new_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("newName"));
                            }
                            new_name__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(ProfileChangeChatUpdate {
                    previous_name: previous_name__.unwrap_or_default(),
                    new_name: new_name__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ProfileChangeChatUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for Quote {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.target_sent_timestamp.is_some() {
            len += 1;
        }
        if self.author_id != 0 {
            len += 1;
        }
        if self.text.is_some() {
            len += 1;
        }
        if !self.attachments.is_empty() {
            len += 1;
        }
        if self.r#type != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Quote", len)?;
        if let Some(v) = self.target_sent_timestamp.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("targetSentTimestamp", ToString::to_string(&v).as_str())?;
        }
        if self.author_id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("authorId", ToString::to_string(&self.author_id).as_str())?;
        }
        if let Some(v) = self.text.as_ref() {
            struct_ser.serialize_field("text", v)?;
        }
        if !self.attachments.is_empty() {
            struct_ser.serialize_field("attachments", &self.attachments)?;
        }
        if self.r#type != 0 {
            let v = quote::Type::try_from(self.r#type)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.r#type)))?;
            struct_ser.serialize_field("type", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for Quote {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "targetSentTimestamp",
            "authorId",
            "text",
            "attachments",
            "type",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            TargetSentTimestamp,
            AuthorId,
            Text,
            Attachments,
            Type,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "targetSentTimestamp" => Ok(GeneratedField::TargetSentTimestamp),
                            "authorId" => Ok(GeneratedField::AuthorId),
                            "text" => Ok(GeneratedField::Text),
                            "attachments" => Ok(GeneratedField::Attachments),
                            "type" => Ok(GeneratedField::Type),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = Quote;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Quote")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Quote, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut target_sent_timestamp__ = None;
                let mut author_id__ = None;
                let mut text__ = None;
                let mut attachments__ = None;
                let mut r#type__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::TargetSentTimestamp => {
                            if target_sent_timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("targetSentTimestamp"));
                            }
                            target_sent_timestamp__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                        GeneratedField::AuthorId => {
                            if author_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("authorId"));
                            }
                            author_id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Text => {
                            if text__.is_some() {
                                return Err(serde::de::Error::duplicate_field("text"));
                            }
                            text__ = map_.next_value()?;
                        }
                        GeneratedField::Attachments => {
                            if attachments__.is_some() {
                                return Err(serde::de::Error::duplicate_field("attachments"));
                            }
                            attachments__ = Some(map_.next_value()?);
                        }
                        GeneratedField::Type => {
                            if r#type__.is_some() {
                                return Err(serde::de::Error::duplicate_field("type"));
                            }
                            r#type__ = Some(map_.next_value::<quote::Type>()? as i32);
                        }
                    }
                }
                Ok(Quote {
                    target_sent_timestamp: target_sent_timestamp__,
                    author_id: author_id__.unwrap_or_default(),
                    text: text__,
                    attachments: attachments__.unwrap_or_default(),
                    r#type: r#type__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Quote", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for quote::QuotedAttachment {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.content_type.is_some() {
            len += 1;
        }
        if self.file_name.is_some() {
            len += 1;
        }
        if self.thumbnail.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Quote.QuotedAttachment", len)?;
        if let Some(v) = self.content_type.as_ref() {
            struct_ser.serialize_field("contentType", v)?;
        }
        if let Some(v) = self.file_name.as_ref() {
            struct_ser.serialize_field("fileName", v)?;
        }
        if let Some(v) = self.thumbnail.as_ref() {
            struct_ser.serialize_field("thumbnail", v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for quote::QuotedAttachment {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "contentType",
            "fileName",
            "thumbnail",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            ContentType,
            FileName,
            Thumbnail,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "contentType" => Ok(GeneratedField::ContentType),
                            "fileName" => Ok(GeneratedField::FileName),
                            "thumbnail" => Ok(GeneratedField::Thumbnail),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = quote::QuotedAttachment;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Quote.QuotedAttachment")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<quote::QuotedAttachment, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut content_type__ = None;
                let mut file_name__ = None;
                let mut thumbnail__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::ContentType => {
                            if content_type__.is_some() {
                                return Err(serde::de::Error::duplicate_field("contentType"));
                            }
                            content_type__ = map_.next_value()?;
                        }
                        GeneratedField::FileName => {
                            if file_name__.is_some() {
                                return Err(serde::de::Error::duplicate_field("fileName"));
                            }
                            file_name__ = map_.next_value()?;
                        }
                        GeneratedField::Thumbnail => {
                            if thumbnail__.is_some() {
                                return Err(serde::de::Error::duplicate_field("thumbnail"));
                            }
                            thumbnail__ = map_.next_value()?;
                        }
                    }
                }
                Ok(quote::QuotedAttachment {
                    content_type: content_type__,
                    file_name: file_name__,
                    thumbnail: thumbnail__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Quote.QuotedAttachment", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for quote::Type {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::Normal => "NORMAL",
            Self::GiftBadge => "GIFT_BADGE",
            Self::ViewOnce => "VIEW_ONCE",
            Self::Poll => "POLL",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for quote::Type {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "NORMAL",
            "GIFT_BADGE",
            "VIEW_ONCE",
            "POLL",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = quote::Type;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(quote::Type::Unknown),
                    "NORMAL" => Ok(quote::Type::Normal),
                    "GIFT_BADGE" => Ok(quote::Type::GiftBadge),
                    "VIEW_ONCE" => Ok(quote::Type::ViewOnce),
                    "POLL" => Ok(quote::Type::Poll),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for Reaction {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.emoji.is_empty() {
            len += 1;
        }
        if self.author_id != 0 {
            len += 1;
        }
        if self.sent_timestamp != 0 {
            len += 1;
        }
        if self.sort_order != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Reaction", len)?;
        if !self.emoji.is_empty() {
            struct_ser.serialize_field("emoji", &self.emoji)?;
        }
        if self.author_id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("authorId", ToString::to_string(&self.author_id).as_str())?;
        }
        if self.sent_timestamp != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("sentTimestamp", ToString::to_string(&self.sent_timestamp).as_str())?;
        }
        if self.sort_order != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("sortOrder", ToString::to_string(&self.sort_order).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for Reaction {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "emoji",
            "authorId",
            "sentTimestamp",
            "sortOrder",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Emoji,
            AuthorId,
            SentTimestamp,
            SortOrder,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "emoji" => Ok(GeneratedField::Emoji),
                            "authorId" => Ok(GeneratedField::AuthorId),
                            "sentTimestamp" => Ok(GeneratedField::SentTimestamp),
                            "sortOrder" => Ok(GeneratedField::SortOrder),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = Reaction;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Reaction")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Reaction, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut emoji__ = None;
                let mut author_id__ = None;
                let mut sent_timestamp__ = None;
                let mut sort_order__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Emoji => {
                            if emoji__.is_some() {
                                return Err(serde::de::Error::duplicate_field("emoji"));
                            }
                            emoji__ = Some(map_.next_value()?);
                        }
                        GeneratedField::AuthorId => {
                            if author_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("authorId"));
                            }
                            author_id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::SentTimestamp => {
                            if sent_timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sentTimestamp"));
                            }
                            sent_timestamp__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::SortOrder => {
                            if sort_order__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sortOrder"));
                            }
                            sort_order__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(Reaction {
                    emoji: emoji__.unwrap_or_default(),
                    author_id: author_id__.unwrap_or_default(),
                    sent_timestamp: sent_timestamp__.unwrap_or_default(),
                    sort_order: sort_order__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Reaction", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for Recipient {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.id != 0 {
            len += 1;
        }
        if self.destination.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Recipient", len)?;
        if self.id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?;
        }
        if let Some(v) = self.destination.as_ref() {
            match v {
                recipient::Destination::Contact(v) => {
                    struct_ser.serialize_field("contact", v)?;
                }
                recipient::Destination::Group(v) => {
                    struct_ser.serialize_field("group", v)?;
                }
                recipient::Destination::DistributionList(v) => {
                    struct_ser.serialize_field("distributionList", v)?;
                }
                recipient::Destination::Self_(v) => {
                    struct_ser.serialize_field("self", v)?;
                }
                recipient::Destination::ReleaseNotes(v) => {
                    struct_ser.serialize_field("releaseNotes", v)?;
                }
                recipient::Destination::CallLink(v) => {
                    struct_ser.serialize_field("callLink", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for Recipient {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "id",
            "contact",
            "group",
            "distributionList",
            "self",
            "releaseNotes",
            "callLink",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Id,
            Contact,
            Group,
            DistributionList,
            Self_,
            ReleaseNotes,
            CallLink,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "id" => Ok(GeneratedField::Id),
                            "contact" => Ok(GeneratedField::Contact),
                            "group" => Ok(GeneratedField::Group),
                            "distributionList" => Ok(GeneratedField::DistributionList),
                            "self" => Ok(GeneratedField::Self_),
                            "releaseNotes" => Ok(GeneratedField::ReleaseNotes),
                            "callLink" => Ok(GeneratedField::CallLink),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = Recipient;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Recipient")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Recipient, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut id__ = None;
                let mut destination__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Id => {
                            if id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("id"));
                            }
                            id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Contact => {
                            if destination__.is_some() {
                                return Err(serde::de::Error::duplicate_field("contact"));
                            }
                            destination__ = map_.next_value::<::std::option::Option<_>>()?.map(recipient::Destination::Contact)
;
                        }
                        GeneratedField::Group => {
                            if destination__.is_some() {
                                return Err(serde::de::Error::duplicate_field("group"));
                            }
                            destination__ = map_.next_value::<::std::option::Option<_>>()?.map(recipient::Destination::Group)
;
                        }
                        GeneratedField::DistributionList => {
                            if destination__.is_some() {
                                return Err(serde::de::Error::duplicate_field("distributionList"));
                            }
                            destination__ = map_.next_value::<::std::option::Option<_>>()?.map(recipient::Destination::DistributionList)
;
                        }
                        GeneratedField::Self_ => {
                            if destination__.is_some() {
                                return Err(serde::de::Error::duplicate_field("self"));
                            }
                            destination__ = map_.next_value::<::std::option::Option<_>>()?.map(recipient::Destination::Self_)
;
                        }
                        GeneratedField::ReleaseNotes => {
                            if destination__.is_some() {
                                return Err(serde::de::Error::duplicate_field("releaseNotes"));
                            }
                            destination__ = map_.next_value::<::std::option::Option<_>>()?.map(recipient::Destination::ReleaseNotes)
;
                        }
                        GeneratedField::CallLink => {
                            if destination__.is_some() {
                                return Err(serde::de::Error::duplicate_field("callLink"));
                            }
                            destination__ = map_.next_value::<::std::option::Option<_>>()?.map(recipient::Destination::CallLink)
;
                        }
                    }
                }
                Ok(Recipient {
                    id: id__.unwrap_or_default(),
                    destination: destination__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Recipient", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for ReleaseNotes {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let len = 0;
        let struct_ser = serializer.serialize_struct("signal.backup.ReleaseNotes", len)?;
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ReleaseNotes {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                            Err(serde::de::Error::unknown_field(value, FIELDS))
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ReleaseNotes;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ReleaseNotes")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ReleaseNotes, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                while map_.next_key::<GeneratedField>()?.is_some() {
                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
                }
                Ok(ReleaseNotes {
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ReleaseNotes", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for RemoteDeletedMessage {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let len = 0;
        let struct_ser = serializer.serialize_struct("signal.backup.RemoteDeletedMessage", len)?;
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for RemoteDeletedMessage {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                            Err(serde::de::Error::unknown_field(value, FIELDS))
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = RemoteDeletedMessage;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.RemoteDeletedMessage")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<RemoteDeletedMessage, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                while map_.next_key::<GeneratedField>()?.is_some() {
                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
                }
                Ok(RemoteDeletedMessage {
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.RemoteDeletedMessage", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for Self_ {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.avatar_color.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Self", len)?;
        if let Some(v) = self.avatar_color.as_ref() {
            let v = AvatarColor::try_from(*v)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?;
            struct_ser.serialize_field("avatarColor", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for Self_ {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "avatarColor",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            AvatarColor,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "avatarColor" => Ok(GeneratedField::AvatarColor),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = Self_;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Self")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Self_, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut avatar_color__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::AvatarColor => {
                            if avatar_color__.is_some() {
                                return Err(serde::de::Error::duplicate_field("avatarColor"));
                            }
                            avatar_color__ = map_.next_value::<::std::option::Option<AvatarColor>>()?.map(|x| x as i32);
                        }
                    }
                }
                Ok(Self_ {
                    avatar_color: avatar_color__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Self", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for SelfInvitedOtherUserToGroupUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.invitee_service_id.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.SelfInvitedOtherUserToGroupUpdate", len)?;
        if !self.invitee_service_id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("inviteeServiceId", pbjson::private::base64::encode(&self.invitee_service_id).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for SelfInvitedOtherUserToGroupUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "inviteeServiceId",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            InviteeServiceId,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "inviteeServiceId" => Ok(GeneratedField::InviteeServiceId),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = SelfInvitedOtherUserToGroupUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.SelfInvitedOtherUserToGroupUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<SelfInvitedOtherUserToGroupUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut invitee_service_id__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::InviteeServiceId => {
                            if invitee_service_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("inviteeServiceId"));
                            }
                            invitee_service_id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(SelfInvitedOtherUserToGroupUpdate {
                    invitee_service_id: invitee_service_id__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.SelfInvitedOtherUserToGroupUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for SelfInvitedToGroupUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.inviter_aci.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.SelfInvitedToGroupUpdate", len)?;
        if let Some(v) = self.inviter_aci.as_ref() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("inviterAci", pbjson::private::base64::encode(&v).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for SelfInvitedToGroupUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "inviterAci",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            InviterAci,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "inviterAci" => Ok(GeneratedField::InviterAci),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = SelfInvitedToGroupUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.SelfInvitedToGroupUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<SelfInvitedToGroupUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut inviter_aci__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::InviterAci => {
                            if inviter_aci__.is_some() {
                                return Err(serde::de::Error::duplicate_field("inviterAci"));
                            }
                            inviter_aci__ = 
                                map_.next_value::<::std::option::Option<::pbjson::private::BytesDeserialize<_>>>()?.map(|x| x.0)
                            ;
                        }
                    }
                }
                Ok(SelfInvitedToGroupUpdate {
                    inviter_aci: inviter_aci__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.SelfInvitedToGroupUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for SendStatus {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.recipient_id != 0 {
            len += 1;
        }
        if self.timestamp != 0 {
            len += 1;
        }
        if self.delivery_status.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.SendStatus", len)?;
        if self.recipient_id != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("recipientId", ToString::to_string(&self.recipient_id).as_str())?;
        }
        if self.timestamp != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?;
        }
        if let Some(v) = self.delivery_status.as_ref() {
            match v {
                send_status::DeliveryStatus::Pending(v) => {
                    struct_ser.serialize_field("pending", v)?;
                }
                send_status::DeliveryStatus::Sent(v) => {
                    struct_ser.serialize_field("sent", v)?;
                }
                send_status::DeliveryStatus::Delivered(v) => {
                    struct_ser.serialize_field("delivered", v)?;
                }
                send_status::DeliveryStatus::Read(v) => {
                    struct_ser.serialize_field("read", v)?;
                }
                send_status::DeliveryStatus::Viewed(v) => {
                    struct_ser.serialize_field("viewed", v)?;
                }
                send_status::DeliveryStatus::Skipped(v) => {
                    struct_ser.serialize_field("skipped", v)?;
                }
                send_status::DeliveryStatus::Failed(v) => {
                    struct_ser.serialize_field("failed", v)?;
                }
            }
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for SendStatus {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "recipientId",
            "timestamp",
            "pending",
            "sent",
            "delivered",
            "read",
            "viewed",
            "skipped",
            "failed",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            RecipientId,
            Timestamp,
            Pending,
            Sent,
            Delivered,
            Read,
            Viewed,
            Skipped,
            Failed,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "recipientId" => Ok(GeneratedField::RecipientId),
                            "timestamp" => Ok(GeneratedField::Timestamp),
                            "pending" => Ok(GeneratedField::Pending),
                            "sent" => Ok(GeneratedField::Sent),
                            "delivered" => Ok(GeneratedField::Delivered),
                            "read" => Ok(GeneratedField::Read),
                            "viewed" => Ok(GeneratedField::Viewed),
                            "skipped" => Ok(GeneratedField::Skipped),
                            "failed" => Ok(GeneratedField::Failed),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = SendStatus;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.SendStatus")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<SendStatus, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut recipient_id__ = None;
                let mut timestamp__ = None;
                let mut delivery_status__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::RecipientId => {
                            if recipient_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("recipientId"));
                            }
                            recipient_id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Timestamp => {
                            if timestamp__.is_some() {
                                return Err(serde::de::Error::duplicate_field("timestamp"));
                            }
                            timestamp__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Pending => {
                            if delivery_status__.is_some() {
                                return Err(serde::de::Error::duplicate_field("pending"));
                            }
                            delivery_status__ = map_.next_value::<::std::option::Option<_>>()?.map(send_status::DeliveryStatus::Pending)
;
                        }
                        GeneratedField::Sent => {
                            if delivery_status__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sent"));
                            }
                            delivery_status__ = map_.next_value::<::std::option::Option<_>>()?.map(send_status::DeliveryStatus::Sent)
;
                        }
                        GeneratedField::Delivered => {
                            if delivery_status__.is_some() {
                                return Err(serde::de::Error::duplicate_field("delivered"));
                            }
                            delivery_status__ = map_.next_value::<::std::option::Option<_>>()?.map(send_status::DeliveryStatus::Delivered)
;
                        }
                        GeneratedField::Read => {
                            if delivery_status__.is_some() {
                                return Err(serde::de::Error::duplicate_field("read"));
                            }
                            delivery_status__ = map_.next_value::<::std::option::Option<_>>()?.map(send_status::DeliveryStatus::Read)
;
                        }
                        GeneratedField::Viewed => {
                            if delivery_status__.is_some() {
                                return Err(serde::de::Error::duplicate_field("viewed"));
                            }
                            delivery_status__ = map_.next_value::<::std::option::Option<_>>()?.map(send_status::DeliveryStatus::Viewed)
;
                        }
                        GeneratedField::Skipped => {
                            if delivery_status__.is_some() {
                                return Err(serde::de::Error::duplicate_field("skipped"));
                            }
                            delivery_status__ = map_.next_value::<::std::option::Option<_>>()?.map(send_status::DeliveryStatus::Skipped)
;
                        }
                        GeneratedField::Failed => {
                            if delivery_status__.is_some() {
                                return Err(serde::de::Error::duplicate_field("failed"));
                            }
                            delivery_status__ = map_.next_value::<::std::option::Option<_>>()?.map(send_status::DeliveryStatus::Failed)
;
                        }
                    }
                }
                Ok(SendStatus {
                    recipient_id: recipient_id__.unwrap_or_default(),
                    timestamp: timestamp__.unwrap_or_default(),
                    delivery_status: delivery_status__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.SendStatus", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for send_status::Delivered {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.sealed_sender {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.SendStatus.Delivered", len)?;
        if self.sealed_sender {
            struct_ser.serialize_field("sealedSender", &self.sealed_sender)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for send_status::Delivered {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "sealedSender",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            SealedSender,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "sealedSender" => Ok(GeneratedField::SealedSender),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = send_status::Delivered;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.SendStatus.Delivered")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<send_status::Delivered, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut sealed_sender__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::SealedSender => {
                            if sealed_sender__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sealedSender"));
                            }
                            sealed_sender__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(send_status::Delivered {
                    sealed_sender: sealed_sender__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.SendStatus.Delivered", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for send_status::Failed {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.reason != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.SendStatus.Failed", len)?;
        if self.reason != 0 {
            let v = send_status::failed::FailureReason::try_from(self.reason)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.reason)))?;
            struct_ser.serialize_field("reason", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for send_status::Failed {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "reason",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Reason,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "reason" => Ok(GeneratedField::Reason),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = send_status::Failed;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.SendStatus.Failed")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<send_status::Failed, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut reason__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Reason => {
                            if reason__.is_some() {
                                return Err(serde::de::Error::duplicate_field("reason"));
                            }
                            reason__ = Some(map_.next_value::<send_status::failed::FailureReason>()? as i32);
                        }
                    }
                }
                Ok(send_status::Failed {
                    reason: reason__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.SendStatus.Failed", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for send_status::failed::FailureReason {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::Network => "NETWORK",
            Self::IdentityKeyMismatch => "IDENTITY_KEY_MISMATCH",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for send_status::failed::FailureReason {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "NETWORK",
            "IDENTITY_KEY_MISMATCH",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = send_status::failed::FailureReason;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(send_status::failed::FailureReason::Unknown),
                    "NETWORK" => Ok(send_status::failed::FailureReason::Network),
                    "IDENTITY_KEY_MISMATCH" => Ok(send_status::failed::FailureReason::IdentityKeyMismatch),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for send_status::Pending {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let len = 0;
        let struct_ser = serializer.serialize_struct("signal.backup.SendStatus.Pending", len)?;
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for send_status::Pending {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                            Err(serde::de::Error::unknown_field(value, FIELDS))
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = send_status::Pending;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.SendStatus.Pending")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<send_status::Pending, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                while map_.next_key::<GeneratedField>()?.is_some() {
                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
                }
                Ok(send_status::Pending {
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.SendStatus.Pending", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for send_status::Read {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.sealed_sender {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.SendStatus.Read", len)?;
        if self.sealed_sender {
            struct_ser.serialize_field("sealedSender", &self.sealed_sender)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for send_status::Read {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "sealedSender",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            SealedSender,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "sealedSender" => Ok(GeneratedField::SealedSender),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = send_status::Read;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.SendStatus.Read")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<send_status::Read, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut sealed_sender__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::SealedSender => {
                            if sealed_sender__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sealedSender"));
                            }
                            sealed_sender__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(send_status::Read {
                    sealed_sender: sealed_sender__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.SendStatus.Read", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for send_status::Sent {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.sealed_sender {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.SendStatus.Sent", len)?;
        if self.sealed_sender {
            struct_ser.serialize_field("sealedSender", &self.sealed_sender)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for send_status::Sent {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "sealedSender",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            SealedSender,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "sealedSender" => Ok(GeneratedField::SealedSender),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = send_status::Sent;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.SendStatus.Sent")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<send_status::Sent, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut sealed_sender__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::SealedSender => {
                            if sealed_sender__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sealedSender"));
                            }
                            sealed_sender__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(send_status::Sent {
                    sealed_sender: sealed_sender__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.SendStatus.Sent", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for send_status::Skipped {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let len = 0;
        let struct_ser = serializer.serialize_struct("signal.backup.SendStatus.Skipped", len)?;
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for send_status::Skipped {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                            Err(serde::de::Error::unknown_field(value, FIELDS))
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = send_status::Skipped;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.SendStatus.Skipped")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<send_status::Skipped, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                while map_.next_key::<GeneratedField>()?.is_some() {
                    let _ = map_.next_value::<serde::de::IgnoredAny>()?;
                }
                Ok(send_status::Skipped {
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.SendStatus.Skipped", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for send_status::Viewed {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.sealed_sender {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.SendStatus.Viewed", len)?;
        if self.sealed_sender {
            struct_ser.serialize_field("sealedSender", &self.sealed_sender)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for send_status::Viewed {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "sealedSender",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            SealedSender,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "sealedSender" => Ok(GeneratedField::SealedSender),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = send_status::Viewed;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.SendStatus.Viewed")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<send_status::Viewed, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut sealed_sender__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::SealedSender => {
                            if sealed_sender__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sealedSender"));
                            }
                            sealed_sender__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(send_status::Viewed {
                    sealed_sender: sealed_sender__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.SendStatus.Viewed", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for SessionSwitchoverChatUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.e164 != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.SessionSwitchoverChatUpdate", len)?;
        if self.e164 != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("e164", ToString::to_string(&self.e164).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for SessionSwitchoverChatUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "e164",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            E164,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "e164" => Ok(GeneratedField::E164),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = SessionSwitchoverChatUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.SessionSwitchoverChatUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<SessionSwitchoverChatUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut e164__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::E164 => {
                            if e164__.is_some() {
                                return Err(serde::de::Error::duplicate_field("e164"));
                            }
                            e164__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(SessionSwitchoverChatUpdate {
                    e164: e164__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.SessionSwitchoverChatUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for SimpleChatUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.r#type != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.SimpleChatUpdate", len)?;
        if self.r#type != 0 {
            let v = simple_chat_update::Type::try_from(self.r#type)
                .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.r#type)))?;
            struct_ser.serialize_field("type", &v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for SimpleChatUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "type",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Type,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "type" => Ok(GeneratedField::Type),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = SimpleChatUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.SimpleChatUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<SimpleChatUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut r#type__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Type => {
                            if r#type__.is_some() {
                                return Err(serde::de::Error::duplicate_field("type"));
                            }
                            r#type__ = Some(map_.next_value::<simple_chat_update::Type>()? as i32);
                        }
                    }
                }
                Ok(SimpleChatUpdate {
                    r#type: r#type__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.SimpleChatUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for simple_chat_update::Type {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let variant = match self {
            Self::Unknown => "UNKNOWN",
            Self::JoinedSignal => "JOINED_SIGNAL",
            Self::IdentityUpdate => "IDENTITY_UPDATE",
            Self::IdentityVerified => "IDENTITY_VERIFIED",
            Self::IdentityDefault => "IDENTITY_DEFAULT",
            Self::ChangeNumber => "CHANGE_NUMBER",
            Self::ReleaseChannelDonationRequest => "RELEASE_CHANNEL_DONATION_REQUEST",
            Self::EndSession => "END_SESSION",
            Self::ChatSessionRefresh => "CHAT_SESSION_REFRESH",
            Self::BadDecrypt => "BAD_DECRYPT",
            Self::PaymentsActivated => "PAYMENTS_ACTIVATED",
            Self::PaymentActivationRequest => "PAYMENT_ACTIVATION_REQUEST",
            Self::UnsupportedProtocolMessage => "UNSUPPORTED_PROTOCOL_MESSAGE",
            Self::ReportedSpam => "REPORTED_SPAM",
            Self::Blocked => "BLOCKED",
            Self::Unblocked => "UNBLOCKED",
            Self::MessageRequestAccepted => "MESSAGE_REQUEST_ACCEPTED",
        };
        serializer.serialize_str(variant)
    }
}
impl<'de> serde::Deserialize<'de> for simple_chat_update::Type {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "UNKNOWN",
            "JOINED_SIGNAL",
            "IDENTITY_UPDATE",
            "IDENTITY_VERIFIED",
            "IDENTITY_DEFAULT",
            "CHANGE_NUMBER",
            "RELEASE_CHANNEL_DONATION_REQUEST",
            "END_SESSION",
            "CHAT_SESSION_REFRESH",
            "BAD_DECRYPT",
            "PAYMENTS_ACTIVATED",
            "PAYMENT_ACTIVATION_REQUEST",
            "UNSUPPORTED_PROTOCOL_MESSAGE",
            "REPORTED_SPAM",
            "BLOCKED",
            "UNBLOCKED",
            "MESSAGE_REQUEST_ACCEPTED",
        ];

        struct GeneratedVisitor;

        impl serde::de::Visitor<'_> for GeneratedVisitor {
            type Value = simple_chat_update::Type;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                write!(formatter, "expected one of: {:?}", &FIELDS)
            }

            fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
                    })
            }

            fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                i32::try_from(v)
                    .ok()
                    .and_then(|x| x.try_into().ok())
                    .ok_or_else(|| {
                        serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
                    })
            }

            fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
            where
                E: serde::de::Error,
            {
                match value {
                    "UNKNOWN" => Ok(simple_chat_update::Type::Unknown),
                    "JOINED_SIGNAL" => Ok(simple_chat_update::Type::JoinedSignal),
                    "IDENTITY_UPDATE" => Ok(simple_chat_update::Type::IdentityUpdate),
                    "IDENTITY_VERIFIED" => Ok(simple_chat_update::Type::IdentityVerified),
                    "IDENTITY_DEFAULT" => Ok(simple_chat_update::Type::IdentityDefault),
                    "CHANGE_NUMBER" => Ok(simple_chat_update::Type::ChangeNumber),
                    "RELEASE_CHANNEL_DONATION_REQUEST" => Ok(simple_chat_update::Type::ReleaseChannelDonationRequest),
                    "END_SESSION" => Ok(simple_chat_update::Type::EndSession),
                    "CHAT_SESSION_REFRESH" => Ok(simple_chat_update::Type::ChatSessionRefresh),
                    "BAD_DECRYPT" => Ok(simple_chat_update::Type::BadDecrypt),
                    "PAYMENTS_ACTIVATED" => Ok(simple_chat_update::Type::PaymentsActivated),
                    "PAYMENT_ACTIVATION_REQUEST" => Ok(simple_chat_update::Type::PaymentActivationRequest),
                    "UNSUPPORTED_PROTOCOL_MESSAGE" => Ok(simple_chat_update::Type::UnsupportedProtocolMessage),
                    "REPORTED_SPAM" => Ok(simple_chat_update::Type::ReportedSpam),
                    "BLOCKED" => Ok(simple_chat_update::Type::Blocked),
                    "UNBLOCKED" => Ok(simple_chat_update::Type::Unblocked),
                    "MESSAGE_REQUEST_ACCEPTED" => Ok(simple_chat_update::Type::MessageRequestAccepted),
                    _ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
                }
            }
        }
        deserializer.deserialize_any(GeneratedVisitor)
    }
}
impl serde::Serialize for StandardMessage {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.quote.is_some() {
            len += 1;
        }
        if self.text.is_some() {
            len += 1;
        }
        if !self.attachments.is_empty() {
            len += 1;
        }
        if !self.link_preview.is_empty() {
            len += 1;
        }
        if self.long_text.is_some() {
            len += 1;
        }
        if !self.reactions.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.StandardMessage", len)?;
        if let Some(v) = self.quote.as_ref() {
            struct_ser.serialize_field("quote", v)?;
        }
        if let Some(v) = self.text.as_ref() {
            struct_ser.serialize_field("text", v)?;
        }
        if !self.attachments.is_empty() {
            struct_ser.serialize_field("attachments", &self.attachments)?;
        }
        if !self.link_preview.is_empty() {
            struct_ser.serialize_field("linkPreview", &self.link_preview)?;
        }
        if let Some(v) = self.long_text.as_ref() {
            struct_ser.serialize_field("longText", v)?;
        }
        if !self.reactions.is_empty() {
            struct_ser.serialize_field("reactions", &self.reactions)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for StandardMessage {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "quote",
            "text",
            "attachments",
            "linkPreview",
            "longText",
            "reactions",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Quote,
            Text,
            Attachments,
            LinkPreview,
            LongText,
            Reactions,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "quote" => Ok(GeneratedField::Quote),
                            "text" => Ok(GeneratedField::Text),
                            "attachments" => Ok(GeneratedField::Attachments),
                            "linkPreview" => Ok(GeneratedField::LinkPreview),
                            "longText" => Ok(GeneratedField::LongText),
                            "reactions" => Ok(GeneratedField::Reactions),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = StandardMessage;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.StandardMessage")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<StandardMessage, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut quote__ = None;
                let mut text__ = None;
                let mut attachments__ = None;
                let mut link_preview__ = None;
                let mut long_text__ = None;
                let mut reactions__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Quote => {
                            if quote__.is_some() {
                                return Err(serde::de::Error::duplicate_field("quote"));
                            }
                            quote__ = map_.next_value()?;
                        }
                        GeneratedField::Text => {
                            if text__.is_some() {
                                return Err(serde::de::Error::duplicate_field("text"));
                            }
                            text__ = map_.next_value()?;
                        }
                        GeneratedField::Attachments => {
                            if attachments__.is_some() {
                                return Err(serde::de::Error::duplicate_field("attachments"));
                            }
                            attachments__ = Some(map_.next_value()?);
                        }
                        GeneratedField::LinkPreview => {
                            if link_preview__.is_some() {
                                return Err(serde::de::Error::duplicate_field("linkPreview"));
                            }
                            link_preview__ = Some(map_.next_value()?);
                        }
                        GeneratedField::LongText => {
                            if long_text__.is_some() {
                                return Err(serde::de::Error::duplicate_field("longText"));
                            }
                            long_text__ = map_.next_value()?;
                        }
                        GeneratedField::Reactions => {
                            if reactions__.is_some() {
                                return Err(serde::de::Error::duplicate_field("reactions"));
                            }
                            reactions__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(StandardMessage {
                    quote: quote__,
                    text: text__,
                    attachments: attachments__.unwrap_or_default(),
                    link_preview: link_preview__.unwrap_or_default(),
                    long_text: long_text__,
                    reactions: reactions__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.StandardMessage", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for Sticker {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.pack_id.is_empty() {
            len += 1;
        }
        if !self.pack_key.is_empty() {
            len += 1;
        }
        if self.sticker_id != 0 {
            len += 1;
        }
        if self.emoji.is_some() {
            len += 1;
        }
        if self.data.is_some() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Sticker", len)?;
        if !self.pack_id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("packId", pbjson::private::base64::encode(&self.pack_id).as_str())?;
        }
        if !self.pack_key.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("packKey", pbjson::private::base64::encode(&self.pack_key).as_str())?;
        }
        if self.sticker_id != 0 {
            struct_ser.serialize_field("stickerId", &self.sticker_id)?;
        }
        if let Some(v) = self.emoji.as_ref() {
            struct_ser.serialize_field("emoji", v)?;
        }
        if let Some(v) = self.data.as_ref() {
            struct_ser.serialize_field("data", v)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for Sticker {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "packId",
            "packKey",
            "stickerId",
            "emoji",
            "data",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            PackId,
            PackKey,
            StickerId,
            Emoji,
            Data,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "packId" => Ok(GeneratedField::PackId),
                            "packKey" => Ok(GeneratedField::PackKey),
                            "stickerId" => Ok(GeneratedField::StickerId),
                            "emoji" => Ok(GeneratedField::Emoji),
                            "data" => Ok(GeneratedField::Data),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = Sticker;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Sticker")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Sticker, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut pack_id__ = None;
                let mut pack_key__ = None;
                let mut sticker_id__ = None;
                let mut emoji__ = None;
                let mut data__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::PackId => {
                            if pack_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("packId"));
                            }
                            pack_id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::PackKey => {
                            if pack_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("packKey"));
                            }
                            pack_key__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::StickerId => {
                            if sticker_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("stickerId"));
                            }
                            sticker_id__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::Emoji => {
                            if emoji__.is_some() {
                                return Err(serde::de::Error::duplicate_field("emoji"));
                            }
                            emoji__ = map_.next_value()?;
                        }
                        GeneratedField::Data => {
                            if data__.is_some() {
                                return Err(serde::de::Error::duplicate_field("data"));
                            }
                            data__ = map_.next_value()?;
                        }
                    }
                }
                Ok(Sticker {
                    pack_id: pack_id__.unwrap_or_default(),
                    pack_key: pack_key__.unwrap_or_default(),
                    sticker_id: sticker_id__.unwrap_or_default(),
                    emoji: emoji__,
                    data: data__,
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Sticker", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for StickerMessage {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.sticker.is_some() {
            len += 1;
        }
        if !self.reactions.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.StickerMessage", len)?;
        if let Some(v) = self.sticker.as_ref() {
            struct_ser.serialize_field("sticker", v)?;
        }
        if !self.reactions.is_empty() {
            struct_ser.serialize_field("reactions", &self.reactions)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for StickerMessage {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "sticker",
            "reactions",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Sticker,
            Reactions,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "sticker" => Ok(GeneratedField::Sticker),
                            "reactions" => Ok(GeneratedField::Reactions),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = StickerMessage;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.StickerMessage")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<StickerMessage, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut sticker__ = None;
                let mut reactions__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Sticker => {
                            if sticker__.is_some() {
                                return Err(serde::de::Error::duplicate_field("sticker"));
                            }
                            sticker__ = map_.next_value()?;
                        }
                        GeneratedField::Reactions => {
                            if reactions__.is_some() {
                                return Err(serde::de::Error::duplicate_field("reactions"));
                            }
                            reactions__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(StickerMessage {
                    sticker: sticker__,
                    reactions: reactions__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.StickerMessage", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for StickerPack {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.pack_id.is_empty() {
            len += 1;
        }
        if !self.pack_key.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.StickerPack", len)?;
        if !self.pack_id.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("packId", pbjson::private::base64::encode(&self.pack_id).as_str())?;
        }
        if !self.pack_key.is_empty() {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("packKey", pbjson::private::base64::encode(&self.pack_key).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for StickerPack {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "packId",
            "packKey",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            PackId,
            PackKey,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "packId" => Ok(GeneratedField::PackId),
                            "packKey" => Ok(GeneratedField::PackKey),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = StickerPack;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.StickerPack")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<StickerPack, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut pack_id__ = None;
                let mut pack_key__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::PackId => {
                            if pack_id__.is_some() {
                                return Err(serde::de::Error::duplicate_field("packId"));
                            }
                            pack_id__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                        GeneratedField::PackKey => {
                            if pack_key__.is_some() {
                                return Err(serde::de::Error::duplicate_field("packKey"));
                            }
                            pack_key__ = 
                                Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(StickerPack {
                    pack_id: pack_id__.unwrap_or_default(),
                    pack_key: pack_key__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.StickerPack", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for Text {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if !self.body.is_empty() {
            len += 1;
        }
        if !self.body_ranges.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.Text", len)?;
        if !self.body.is_empty() {
            struct_ser.serialize_field("body", &self.body)?;
        }
        if !self.body_ranges.is_empty() {
            struct_ser.serialize_field("bodyRanges", &self.body_ranges)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for Text {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "body",
            "bodyRanges",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Body,
            BodyRanges,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "body" => Ok(GeneratedField::Body),
                            "bodyRanges" => Ok(GeneratedField::BodyRanges),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = Text;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.Text")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<Text, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut body__ = None;
                let mut body_ranges__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Body => {
                            if body__.is_some() {
                                return Err(serde::de::Error::duplicate_field("body"));
                            }
                            body__ = Some(map_.next_value()?);
                        }
                        GeneratedField::BodyRanges => {
                            if body_ranges__.is_some() {
                                return Err(serde::de::Error::duplicate_field("bodyRanges"));
                            }
                            body_ranges__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(Text {
                    body: body__.unwrap_or_default(),
                    body_ranges: body_ranges__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.Text", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for ThreadMergeChatUpdate {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.previous_e164 != 0 {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ThreadMergeChatUpdate", len)?;
        if self.previous_e164 != 0 {
            #[allow(clippy::needless_borrow)]
            #[allow(clippy::needless_borrows_for_generic_args)]
            struct_ser.serialize_field("previousE164", ToString::to_string(&self.previous_e164).as_str())?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ThreadMergeChatUpdate {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "previousE164",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            PreviousE164,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "previousE164" => Ok(GeneratedField::PreviousE164),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ThreadMergeChatUpdate;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ThreadMergeChatUpdate")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ThreadMergeChatUpdate, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut previous_e164__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::PreviousE164 => {
                            if previous_e164__.is_some() {
                                return Err(serde::de::Error::duplicate_field("previousE164"));
                            }
                            previous_e164__ = 
                                Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
                            ;
                        }
                    }
                }
                Ok(ThreadMergeChatUpdate {
                    previous_e164: previous_e164__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ThreadMergeChatUpdate", FIELDS, GeneratedVisitor)
    }
}
impl serde::Serialize for ViewOnceMessage {
    #[allow(deprecated)]
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        use serde::ser::SerializeStruct;
        let mut len = 0;
        if self.attachment.is_some() {
            len += 1;
        }
        if !self.reactions.is_empty() {
            len += 1;
        }
        let mut struct_ser = serializer.serialize_struct("signal.backup.ViewOnceMessage", len)?;
        if let Some(v) = self.attachment.as_ref() {
            struct_ser.serialize_field("attachment", v)?;
        }
        if !self.reactions.is_empty() {
            struct_ser.serialize_field("reactions", &self.reactions)?;
        }
        struct_ser.end()
    }
}
impl<'de> serde::Deserialize<'de> for ViewOnceMessage {
    #[allow(deprecated)]
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        const FIELDS: &[&str] = &[
            "attachment",
            "reactions",
        ];

        #[allow(clippy::enum_variant_names)]
        enum GeneratedField {
            Attachment,
            Reactions,
        }
        impl<'de> serde::Deserialize<'de> for GeneratedField {
            fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
            where
                D: serde::Deserializer<'de>,
            {
                struct GeneratedVisitor;

                impl serde::de::Visitor<'_> for GeneratedVisitor {
                    type Value = GeneratedField;

                    fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                        write!(formatter, "expected one of: {:?}", &FIELDS)
                    }

                    #[allow(unused_variables)]
                    fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
                    where
                        E: serde::de::Error,
                    {
                        match value {
                            "attachment" => Ok(GeneratedField::Attachment),
                            "reactions" => Ok(GeneratedField::Reactions),
                            _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
                        }
                    }
                }
                deserializer.deserialize_identifier(GeneratedVisitor)
            }
        }
        struct GeneratedVisitor;
        impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
            type Value = ViewOnceMessage;

            fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                formatter.write_str("struct signal.backup.ViewOnceMessage")
            }

            fn visit_map<V>(self, mut map_: V) -> std::result::Result<ViewOnceMessage, V::Error>
                where
                    V: serde::de::MapAccess<'de>,
            {
                let mut attachment__ = None;
                let mut reactions__ = None;
                while let Some(k) = map_.next_key()? {
                    match k {
                        GeneratedField::Attachment => {
                            if attachment__.is_some() {
                                return Err(serde::de::Error::duplicate_field("attachment"));
                            }
                            attachment__ = map_.next_value()?;
                        }
                        GeneratedField::Reactions => {
                            if reactions__.is_some() {
                                return Err(serde::de::Error::duplicate_field("reactions"));
                            }
                            reactions__ = Some(map_.next_value()?);
                        }
                    }
                }
                Ok(ViewOnceMessage {
                    attachment: attachment__,
                    reactions: reactions__.unwrap_or_default(),
                })
            }
        }
        deserializer.deserialize_struct("signal.backup.ViewOnceMessage", FIELDS, GeneratedVisitor)
    }
}
