//// <auto-generated/>

//namespace MyTelegram.Services.Serializers;
//// Count:82
//// MyTelegram.Core
//public class AcksDataReceivedEventRawDataSerializer : IRawDataSerializer<AcksDataReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, AcksDataReceivedEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.RequestId);
//        writer.Write(data.ObjectId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Layer);
//        writer.Write(data.Date);
//        writer.Write((byte)data.DeviceType);
//        writer.WriteString(data.ClientIp);
//        writer.Write(data.SessionId);
//        writer.Write(data.AccessHashKeyId);
//    }

//    public AcksDataReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var requestId = buffer.ReadGuid();
//        var objectId = buffer.ReadUInt32();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var layer = buffer.ReadInt32();
//        var date = buffer.ReadInt64();
//        var deviceType = (DeviceType)buffer.ReadByte();
//        var clientIp = buffer.ReadString2() ?? string.Empty;
//        var sessionId = buffer.ReadInt64();
//        var accessHashKeyId = buffer.ReadInt64();

//        return new AcksDataReceivedEvent(connectionId, requestId, objectId, userId, reqMsgId, seqNumber, authKeyId, permAuthKeyId, data, layer, date, deviceType, clientIp, sessionId, accessHashKeyId);
//    }
//}
//public class AppCodeCreatedIntegrationEventRawDataSerializer : IRawDataSerializer<AppCodeCreatedIntegrationEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, AppCodeCreatedIntegrationEvent data)
//    {
//        writer.Write(data.UserId);
//        writer.WriteString(data.PhoneNumber);
//        writer.WriteString(data.Code);
//        writer.Write(data.Expire);
//    }

//    public AppCodeCreatedIntegrationEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();
//        var phoneNumber = buffer.ReadString2() ?? string.Empty;
//        var code = buffer.ReadString2() ?? string.Empty;
//        var expire = buffer.ReadInt32();

//        return new AppCodeCreatedIntegrationEvent(userId, phoneNumber, code, expire);
//    }
//}
//public class AuthCacheItemRawDataSerializer : IRawDataSerializer<AuthCacheItem>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, AuthCacheItem data)
//    {
//        writer.Write(data.Nonce);
//        writer.Write(data.ServerNonce);
//        writer.Write(data.P);
//        writer.Write(data.Q);
//        writer.WriteBool(data.IsPermanent);
//        writer.Write(data.NewNonce);
//        writer.Write(data.A);
//        writer.Write(data.Ga);
//        writer.Write(data.DcId);
//    }

//    public AuthCacheItem Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var nonce = buffer.ReadBytes();
//        var serverNonce = buffer.ReadBytes();
//        var p = buffer.ReadBytes();
//        var q = buffer.ReadBytes();
//        var isPermanent = buffer.ReadBoolean();
//        var newNonce = buffer.ReadBytes();
//        var a = buffer.ReadBytes();
//        var ga = buffer.ReadBytes();
//        var dcId = buffer.ReadNullableInt32();

//        return new AuthCacheItem(nonce, serverNonce, p, q, isPermanent, newNonce, a, ga, dcId);
//    }
//}
//public class AuthKeyCacheItemRawDataSerializer : IRawDataSerializer<AuthKeyCacheItem>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, AuthKeyCacheItem data)
//    {
//        writer.Write(data.AuthKeyData);
//        writer.Write(data.ServerSalt);
//        writer.WriteBool(data.IsPermanent);
//        writer.Write(data.UserId);
//    }

//    public AuthKeyCacheItem Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var authKeyData = buffer.ReadBytes();
//        var serverSalt = buffer.ReadInt64();
//        var isPermanent = buffer.ReadBoolean();
//        var userId = buffer.ReadInt64();

//        return new AuthKeyCacheItem(authKeyData, serverSalt, isPermanent, userId);
//    }
//}
//public class AuthKeyCreatedIntegrationEventRawDataSerializer : IRawDataSerializer<AuthKeyCreatedIntegrationEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, AuthKeyCreatedIntegrationEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.Data);
//        writer.Write(data.ServerSalt);
//        writer.WriteBool(data.IsPermanent);
//        writer.Write(data.SetClientDhParamsAnswer);
//        writer.Write(data.DcId);
//    }

//    public AuthKeyCreatedIntegrationEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var reqMsgId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var serverSalt = buffer.ReadInt64();
//        var isPermanent = buffer.ReadBoolean();
//        var setClientDhParamsAnswer = buffer.ReadMemory();
//        var dcId = buffer.ReadNullableInt32();

//        return new AuthKeyCreatedIntegrationEvent(connectionId, reqMsgId, data, serverSalt, isPermanent, setClientDhParamsAnswer, dcId);
//    }
//}
//public class AuthKeyNotFoundEventRawDataSerializer : IRawDataSerializer<AuthKeyNotFoundEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, AuthKeyNotFoundEvent data)
//    {
//        writer.Write(data.AuthKeyId);
//        writer.WriteString(data.ConnectionId);
//    }

//    public AuthKeyNotFoundEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var authKeyId = buffer.ReadInt64();
//        var connectionId = buffer.ReadString2() ?? string.Empty;

//        return new AuthKeyNotFoundEvent(authKeyId, connectionId);
//    }
//}
//public class AuthKeyUnRegisteredIntegrationEventRawDataSerializer : IRawDataSerializer<AuthKeyUnRegisteredIntegrationEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, AuthKeyUnRegisteredIntegrationEvent data)
//    {
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.TempAuthKeyId);
//    }

//    public AuthKeyUnRegisteredIntegrationEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var permAuthKeyId = buffer.ReadInt64();
//        var tempAuthKeyId = buffer.ReadInt64();

//        return new AuthKeyUnRegisteredIntegrationEvent(permAuthKeyId, tempAuthKeyId);
//    }
//}
//public class BindUidToAuthKeyIntegrationEventRawDataSerializer : IRawDataSerializer<BindUidToAuthKeyIntegrationEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, BindUidToAuthKeyIntegrationEvent data)
//    {
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.UserId);
//    }

//    public BindUidToAuthKeyIntegrationEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var userId = buffer.ReadInt64();

//        return new BindUidToAuthKeyIntegrationEvent(authKeyId, permAuthKeyId, userId);
//    }
//}
//public class BindUidToSessionEventRawDataSerializer : IRawDataSerializer<BindUidToSessionEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, BindUidToSessionEvent data)
//    {
//        writer.Write(data.UserId);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//    }

//    public BindUidToSessionEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();

//        return new BindUidToSessionEvent(userId, authKeyId, permAuthKeyId);
//    }
//}
//public class BindUserIdToAuthKeySuccessEventRawDataSerializer : IRawDataSerializer<BindUserIdToAuthKeySuccessEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, BindUserIdToAuthKeySuccessEvent data)
//    {
//        writer.Write(data.TempAuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.UserId);
//    }

//    public BindUserIdToAuthKeySuccessEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var tempAuthKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var userId = buffer.ReadInt64();

//        return new BindUserIdToAuthKeySuccessEvent(tempAuthKeyId, permAuthKeyId, userId);
//    }
//}
//public class BotCommandResponseRawDataSerializer : IRawDataSerializer<BotCommandResponse>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, BotCommandResponse data)
//    {
//        writer.Write(data.BotUserId);
//        writer.Write(data.ChatId);
//        writer.WriteString(data.Text);
//        writer.WriteBool(data.IsEdit);
//        writer.Write(data.MessageId);
//        writer.Write(data.Entities);
//        writer.Write(data.ReplyMarkup);
//    }

//    public BotCommandResponse Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var botUserId = buffer.ReadInt64();
//        var chatId = buffer.ReadInt64();
//        var text = buffer.ReadString2() ?? string.Empty;
//        var isEdit = buffer.ReadBoolean();
//        var messageId = buffer.ReadInt32();
//        var entities = buffer.ReadBytes();
//        var replyMarkup = buffer.ReadBytes();

//        return new BotCommandResponse(botUserId, chatId, text, isEdit, messageId, entities, replyMarkup);
//    }
//}
//public class BotDataReceivedEventRawDataSerializer : IRawDataSerializer<BotDataReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, BotDataReceivedEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.RequestId);
//        writer.Write(data.ObjectId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Layer);
//        writer.Write(data.Date);
//        writer.Write((byte)data.DeviceType);
//        writer.WriteString(data.ClientIp);
//        writer.Write(data.SessionId);
//        writer.Write(data.AccessHashKeyId);
//    }

//    public BotDataReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var requestId = buffer.ReadGuid();
//        var objectId = buffer.ReadUInt32();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var layer = buffer.ReadInt32();
//        var date = buffer.ReadInt64();
//        var deviceType = (DeviceType)buffer.ReadByte();
//        var clientIp = buffer.ReadString2() ?? string.Empty;
//        var sessionId = buffer.ReadInt64();
//        var accessHashKeyId = buffer.ReadInt64();

//        return new BotDataReceivedEvent(connectionId, requestId, objectId, userId, reqMsgId, seqNumber, authKeyId, permAuthKeyId, data, layer, date, deviceType, clientIp, sessionId, accessHashKeyId);
//    }
//}
//public class BotUserDataUpdatedEventRawDataSerializer : IRawDataSerializer<BotUserDataUpdatedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, BotUserDataUpdatedEvent data)
//    {
//        writer.Write(data.BotUserId);
//    }

//    public BotUserDataUpdatedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var botUserId = buffer.ReadInt64();

//        return new BotUserDataUpdatedEvent(botUserId);
//    }
//}
//public class BotUserDataUpdatedEvent2RawDataSerializer : IRawDataSerializer<BotUserDataUpdatedEvent2>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, BotUserDataUpdatedEvent2 data)
//    {
//        writer.Write(data.BotUserId);
//    }

//    public BotUserDataUpdatedEvent2 Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var botUserId = buffer.ReadInt64();

//        return new BotUserDataUpdatedEvent2(botUserId);
//    }
//}
//public class BotWebHookLocalRequestCreatedIntegrationEventRawDataSerializer : IRawDataSerializer<BotWebHookLocalRequestCreatedIntegrationEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, BotWebHookLocalRequestCreatedIntegrationEvent data)
//    {
//        writer.WriteString(data.WebHookUrl);
//        writer.WriteString(data.JsonData);
//    }

//    public BotWebHookLocalRequestCreatedIntegrationEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var webHookUrl = buffer.ReadString2() ?? string.Empty;
//        var jsonData = buffer.ReadString2() ?? string.Empty;

//        return new BotWebHookLocalRequestCreatedIntegrationEvent(webHookUrl, jsonData);
//    }
//}
//public class BotWebHookRequestCreatedIntegrationEventRawDataSerializer : IRawDataSerializer<BotWebHookRequestCreatedIntegrationEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, BotWebHookRequestCreatedIntegrationEvent data)
//    {
//        writer.WriteString(data.WebHookUrl);
//        writer.WriteString(data.JsonData);
//    }

//    public BotWebHookRequestCreatedIntegrationEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var webHookUrl = buffer.ReadString2() ?? string.Empty;
//        var jsonData = buffer.ReadString2() ?? string.Empty;

//        return new BotWebHookRequestCreatedIntegrationEvent(webHookUrl, jsonData);
//    }
//}
//public class ChangeBotPicEventRawDataSerializer : IRawDataSerializer<ChangeBotPicEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, ChangeBotPicEvent data)
//    {
//        writer.Write(data.OwnerUserId);
//        writer.Write(data.BotUserId);
//        writer.Write(data.MessageId);
//        writer.WriteBool(data.IsDescriptionPic);
//    }

//    public ChangeBotPicEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var ownerUserId = buffer.ReadInt64();
//        var botUserId = buffer.ReadInt64();
//        var messageId = buffer.ReadInt32();
//        var isDescriptionPic = buffer.ReadBoolean();

//        return new ChangeBotPicEvent(ownerUserId, botUserId, messageId, isDescriptionPic);
//    }
//}
//public class ChannelMemberBannedEventRawDataSerializer : IRawDataSerializer<ChannelMemberBannedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, ChannelMemberBannedEvent data)
//    {
//        writer.Write(data.ChannelId);
//        writer.Write(data.UserId);
//        writer.Write(data.BannedRights);
//        writer.Write(data.UntilDate);
//    }

//    public ChannelMemberBannedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var channelId = buffer.ReadInt64();
//        var userId = buffer.ReadInt64();
//        var bannedRights = buffer.ReadInt32();
//        var untilDate = buffer.ReadInt32();

//        return new ChannelMemberBannedEvent(channelId, userId, bannedRights, untilDate);
//    }
//}
//public class ChannelMemberChangedEventRawDataSerializer : IRawDataSerializer<ChannelMemberChangedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, ChannelMemberChangedEvent data)
//    {
//        writer.Write(data.ChannelId);
//        writer.Write((byte)data.MemberStateChangeType);
//        writer.Write(data.MemberUidList);
//    }

//    public ChannelMemberChangedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var channelId = buffer.ReadInt64();
//        var memberStateChangeType = (MemberStateChangeType)buffer.ReadByte();
//        var memberUidList = buffer.ReadList();

//        return new ChannelMemberChangedEvent(channelId, memberStateChangeType, memberUidList);
//    }
//}
//public class ChannelReactionChangedIntegrationEventRawDataSerializer : IRawDataSerializer<ChannelReactionChangedIntegrationEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, ChannelReactionChangedIntegrationEvent data)
//    {
//        writer.Write(data.Updates);
//        writer.Write(data.ReactionUserIds);
//    }

//    public ChannelReactionChangedIntegrationEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var updates = buffer.ReadBytes();
//        var reactionUserIds = buffer.ReadList();

//        return new ChannelReactionChangedIntegrationEvent(updates, reactionUserIds);
//    }
//}
//public class ChatMemberChangedEventRawDataSerializer : IRawDataSerializer<ChatMemberChangedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, ChatMemberChangedEvent data)
//    {
//        writer.Write(data.ChatId);
//        writer.Write((byte)data.MemberStateChangeType);
//        writer.Write(data.MemberUidList);
//    }

//    public ChatMemberChangedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var chatId = buffer.ReadInt64();
//        var memberStateChangeType = (MemberStateChangeType)buffer.ReadByte();
//        var memberUidList = buffer.ReadList();

//        return new ChatMemberChangedEvent(chatId, memberStateChangeType, memberUidList);
//    }
//}
//public class ClientDisconnectedEventRawDataSerializer : IRawDataSerializer<ClientDisconnectedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, ClientDisconnectedEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.SessionId);
//    }

//    public ClientDisconnectedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var authKeyId = buffer.ReadInt64();
//        var sessionId = buffer.ReadInt64();

//        return new ClientDisconnectedEvent(connectionId, authKeyId, sessionId);
//    }
//}
//public class CreateCollectibleUsernameInputRawDataSerializer : IRawDataSerializer<CreateCollectibleUsernameInput>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, CreateCollectibleUsernameInput data)
//    {
//        writer.Write(data.OwnerPeerId);
//        writer.WriteString(data.UserName);
//    }

//    public CreateCollectibleUsernameInput Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var ownerPeerId = buffer.ReadInt64();
//        var userName = buffer.ReadString2() ?? string.Empty;

//        return new CreateCollectibleUsernameInput(ownerPeerId, userName);
//    }
//}
//public class CreateEncryptedPushMessageEventRawDataSerializer : IRawDataSerializer<CreateEncryptedPushMessageEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, CreateEncryptedPushMessageEvent data)
//    {
//        writer.Write(data.InboxOwnerPeerId);
//        writer.Write(data.Data);
//        writer.Write(data.Qts);
//        writer.Write(data.InboxOwnerPermAuthKeyId);
//    }

//    public CreateEncryptedPushMessageEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var inboxOwnerPeerId = buffer.ReadInt64();
//        var data = buffer.ReadBytes();
//        var qts = buffer.ReadInt32();
//        var inboxOwnerPermAuthKeyId = buffer.ReadInt64();

//        return new CreateEncryptedPushMessageEvent(inboxOwnerPeerId, data, qts, inboxOwnerPermAuthKeyId);
//    }
//}
//public class CreateNewWebPageEventRawDataSerializer : IRawDataSerializer<CreateNewWebPageEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, CreateNewWebPageEvent data)
//    {
//        writer.Write(data.UserId);
//        writer.Write(data.PermAuthKeyId);
//        writer.WriteString(data.Url);
//        writer.Write(data.WebPageId);
//        writer.Write((byte)data.WebPageLoadType);
//    }

//    public CreateNewWebPageEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var url = buffer.ReadString2() ?? string.Empty;
//        var webPageId = buffer.ReadInt64();
//        var webPageLoadType = (WebPageLoadType)buffer.ReadByte();

//        return new CreateNewWebPageEvent(userId, permAuthKeyId, url, webPageId, webPageLoadType);
//    }
//}
//public class CreatePushMessageEventRawDataSerializer : IRawDataSerializer<CreatePushMessageEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, CreatePushMessageEvent data)
//    {
//        writer.Write(data.ToPeer);
//        writer.Write(data.Data);
//        writer.Write(data.Pts);
//        writer.Write(data.OnlyPushToThisAuthKeyId);
//    }

//    public CreatePushMessageEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var toPeer = buffer.ReadPeer();
//        var data = buffer.ReadBytes();
//        var pts = buffer.ReadInt32();
//        var onlyPushToThisAuthKeyId = buffer.ReadInt64();

//        return new CreatePushMessageEvent(toPeer, data, pts, onlyPushToThisAuthKeyId);
//    }
//}
//public class DataReceivedEventRawDataSerializer : IRawDataSerializer<DataReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, DataReceivedEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.RequestId);
//        writer.Write(data.ObjectId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Layer);
//        writer.Write(data.Date);
//        writer.Write((byte)data.DeviceType);
//        writer.WriteString(data.ClientIp);
//        writer.Write(data.SessionId);
//        writer.Write(data.AccessHashKeyId);
//    }

//    public DataReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var requestId = buffer.ReadGuid();
//        var objectId = buffer.ReadUInt32();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var layer = buffer.ReadInt32();
//        var date = buffer.ReadInt64();
//        var deviceType = (DeviceType)buffer.ReadByte();
//        var clientIp = buffer.ReadString2() ?? string.Empty;
//        var sessionId = buffer.ReadInt64();
//        var accessHashKeyId = buffer.ReadInt64();

//        return new DataReceivedEvent(connectionId, requestId, objectId, userId, reqMsgId, seqNumber, authKeyId, permAuthKeyId, data, layer, date, deviceType, clientIp, sessionId, accessHashKeyId);
//    }
//}
//public class DataResultResponseReceivedEventRawDataSerializer : IRawDataSerializer<DataResultResponseReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, DataResultResponseReceivedEvent data)
//    {
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.Data);
//    }

//    public DataResultResponseReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var reqMsgId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();

//        return new DataResultResponseReceivedEvent(reqMsgId, data);
//    }
//}
//public class DataResultResponseWithUserIdReceivedEventRawDataSerializer : IRawDataSerializer<DataResultResponseWithUserIdReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, DataResultResponseWithUserIdReceivedEvent data)
//    {
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.Data);
//        writer.Write(data.UserId);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//    }

//    public DataResultResponseWithUserIdReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var reqMsgId = buffer.ReadInt64();
//        var data = buffer.ReadBytes();
//        var userId = buffer.ReadInt64();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();

//        return new DataResultResponseWithUserIdReceivedEvent(reqMsgId, data, userId, authKeyId, permAuthKeyId);
//    }
//}
//public class DeleteLanguageTextInputRawDataSerializer : IRawDataSerializer<DeleteLanguageTextInput>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, DeleteLanguageTextInput data)
//    {
//        writer.WriteString(data.LanguageCode);
//        writer.Write((byte)data.Platform);
//        writer.WriteString(data.Key);
//    }

//    public DeleteLanguageTextInput Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var languageCode = buffer.ReadString2() ?? string.Empty;
//        var platform = (DeviceType)buffer.ReadByte();
//        var key = buffer.ReadString2() ?? string.Empty;

//        return new DeleteLanguageTextInput(languageCode, platform, key);
//    }
//}
//public class DeviceRegisteredEventRawDataSerializer : IRawDataSerializer<DeviceRegisteredEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, DeviceRegisteredEvent data)
//    {
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.SessionId);
//    }

//    public DeviceRegisteredEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var sessionId = buffer.ReadInt64();

//        return new DeviceRegisteredEvent(authKeyId, permAuthKeyId, sessionId);
//    }
//}
//public class DomainEventMessageRawDataSerializer : IRawDataSerializer<DomainEventMessage>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, DomainEventMessage data)
//    {
//        writer.WriteString(data.EventId);
//        writer.WriteString(data.Message);
//        writer.Write(data.Headers);
//    }

//    public DomainEventMessage Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var eventId = buffer.ReadString2() ?? string.Empty;
//        var message = buffer.ReadString2() ?? string.Empty;
//        var headers = buffer.ReadDictionary();

//        return new DomainEventMessage(eventId, message, headers);
//    }
//}
//public class DownloadDataReceivedEventRawDataSerializer : IRawDataSerializer<DownloadDataReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, DownloadDataReceivedEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.RequestId);
//        writer.Write(data.ObjectId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Layer);
//        writer.Write(data.Date);
//        writer.Write((byte)data.DeviceType);
//        writer.WriteString(data.ClientIp);
//        writer.Write(data.SessionId);
//        writer.Write(data.AccessHashKeyId);
//    }

//    public DownloadDataReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var requestId = buffer.ReadGuid();
//        var objectId = buffer.ReadUInt32();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var layer = buffer.ReadInt32();
//        var date = buffer.ReadInt64();
//        var deviceType = (DeviceType)buffer.ReadByte();
//        var clientIp = buffer.ReadString2() ?? string.Empty;
//        var sessionId = buffer.ReadInt64();
//        var accessHashKeyId = buffer.ReadInt64();

//        return new DownloadDataReceivedEvent(connectionId, requestId, objectId, userId, reqMsgId, seqNumber, authKeyId, permAuthKeyId, data, layer, date, deviceType, clientIp, sessionId, accessHashKeyId);
//    }
//}
//public class DuplicateCommandEventRawDataSerializer : IRawDataSerializer<DuplicateCommandEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, DuplicateCommandEvent data)
//    {
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//    }

//    public DuplicateCommandEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var permAuthKeyId = buffer.ReadInt64();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();

//        return new DuplicateCommandEvent(permAuthKeyId, userId, reqMsgId);
//    }
//}
//public class EmailCodeCreatedIntegrationEventRawDataSerializer : IRawDataSerializer<EmailCodeCreatedIntegrationEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, EmailCodeCreatedIntegrationEvent data)
//    {
//        writer.Write(data.UserId);
//        writer.WriteString(data.Email);
//        writer.WriteString(data.Code);
//        writer.Write(data.Expire);
//    }

//    public EmailCodeCreatedIntegrationEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();
//        var email = buffer.ReadString2() ?? string.Empty;
//        var code = buffer.ReadString2() ?? string.Empty;
//        var expire = buffer.ReadInt32();

//        return new EmailCodeCreatedIntegrationEvent(userId, email, code, expire);
//    }
//}
//public class FileDataResultResponseReceivedEventRawDataSerializer : IRawDataSerializer<FileDataResultResponseReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, FileDataResultResponseReceivedEvent data)
//    {
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.Data);
//    }

//    public FileDataResultResponseReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var reqMsgId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();

//        return new FileDataResultResponseReceivedEvent(reqMsgId, data);
//    }
//}
//public class FutureAuthTokenCacheItemRawDataSerializer : IRawDataSerializer<FutureAuthTokenCacheItem>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, FutureAuthTokenCacheItem data)
//    {
//        writer.Write(data.UserId);
//        writer.WriteString(data.AuthTokenId);
//    }

//    public FutureAuthTokenCacheItem Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();
//        var authTokenId = buffer.ReadString2() ?? string.Empty;

//        return new FutureAuthTokenCacheItem(userId, authTokenId);
//    }
//}
//public class FutureSaltCacheItemRawDataSerializer : IRawDataSerializer<FutureSaltCacheItem>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, FutureSaltCacheItem data)
//    {
//        writer.Write(data.Salt);
//        writer.Write(data.ValidSince);
//        writer.Write(data.ValidUntil);
//    }

//    public FutureSaltCacheItem Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var salt = buffer.ReadInt64();
//        var validSince = buffer.ReadInt32();
//        var validUntil = buffer.ReadInt32();

//        return new FutureSaltCacheItem(salt, validSince, validUntil);
//    }
//}
//public class GlobalPrivacySettingsCacheItemRawDataSerializer : IRawDataSerializer<GlobalPrivacySettingsCacheItem>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, GlobalPrivacySettingsCacheItem data)
//    {
//        writer.WriteBool(data.ArchiveAndMuteNewNoncontactPeers);
//        writer.WriteBool(data.KeepArchivedUnmuted);
//        writer.WriteBool(data.KeepArchivedFolders);
//        writer.WriteBool(data.HideReadMarks);
//        writer.WriteBool(data.NewNoncontactPeersRequirePremium);
//    }

//    public GlobalPrivacySettingsCacheItem Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var archiveAndMuteNewNoncontactPeers = buffer.ReadBoolean();
//        var keepArchivedUnmuted = buffer.ReadBoolean();
//        var keepArchivedFolders = buffer.ReadBoolean();
//        var hideReadMarks = buffer.ReadBoolean();
//        var newNoncontactPeersRequirePremium = buffer.ReadBoolean();

//        return new GlobalPrivacySettingsCacheItem(archiveAndMuteNewNoncontactPeers, keepArchivedUnmuted, keepArchivedFolders, hideReadMarks, newNoncontactPeersRequirePremium);
//    }
//}
//public class LayeredAuthKeyIdMessageCreatedIntegrationEventRawDataSerializer : IRawDataSerializer<LayeredAuthKeyIdMessageCreatedIntegrationEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, LayeredAuthKeyIdMessageCreatedIntegrationEvent data)
//    {
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Pts);
//        writer.Write(data.Qts);
//        writer.Write(data.GlobalSeqNo);
//    }

//    public LayeredAuthKeyIdMessageCreatedIntegrationEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var authKeyId = buffer.ReadInt64();
//        var data = buffer.ReadBytes();
//        var pts = buffer.ReadInt32();
//        var qts = buffer.ReadNullableInt32();
//        var globalSeqNo = buffer.ReadInt64();

//        return new LayeredAuthKeyIdMessageCreatedIntegrationEvent(authKeyId, data, pts, qts, globalSeqNo);
//    }
//}
//public class LayeredPushMessageCreatedIntegrationEventRawDataSerializer : IRawDataSerializer<LayeredPushMessageCreatedIntegrationEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, LayeredPushMessageCreatedIntegrationEvent data)
//    {
//        writer.Write((byte)data.PeerType);
//        writer.Write(data.PeerId);
//        writer.Write(data.Data);
//        writer.Write(data.ExcludeAuthKeyId);
//        writer.Write(data.ExcludeUserId);
//        writer.Write(data.OnlySendToUserId);
//        writer.Write(data.OnlySendToThisAuthKeyId);
//        writer.Write(data.Pts);
//        writer.Write(data.Qts);
//        writer.Write(data.GlobalSeqNo);
//        writer.Write(data.PushData);
//        writer.Write(data.ExcludeUserIds);
//    }

//    public LayeredPushMessageCreatedIntegrationEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var peerType = (PeerType)buffer.ReadByte();
//        var peerId = buffer.ReadInt64();
//        var data = buffer.ReadBytes();
//        var excludeAuthKeyId = buffer.ReadNullableInt64();
//        var excludeUserId = buffer.ReadNullableInt64();
//        var onlySendToUserId = buffer.ReadNullableInt64();
//        var onlySendToThisAuthKeyId = buffer.ReadNullableInt64();
//        var pts = buffer.ReadInt32();
//        var qts = buffer.ReadNullableInt32();
//        var globalSeqNo = buffer.ReadInt64();
//        var pushData = buffer.ReadPushData();
//        var excludeUserIds = buffer.ReadList();

//        return new LayeredPushMessageCreatedIntegrationEvent(peerType, peerId, data, excludeAuthKeyId, excludeUserId, onlySendToUserId, onlySendToThisAuthKeyId, pts, qts, globalSeqNo, pushData, excludeUserIds);
//    }
//}
//public class MessengerCommandDataReceivedEventRawDataSerializer : IRawDataSerializer<MessengerCommandDataReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, MessengerCommandDataReceivedEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.RequestId);
//        writer.Write(data.ObjectId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Layer);
//        writer.Write(data.Date);
//        writer.Write((byte)data.DeviceType);
//        writer.WriteString(data.ClientIp);
//        writer.Write(data.SessionId);
//        writer.Write(data.AccessHashKeyId);
//    }

//    public MessengerCommandDataReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var requestId = buffer.ReadGuid();
//        var objectId = buffer.ReadUInt32();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var layer = buffer.ReadInt32();
//        var date = buffer.ReadInt64();
//        var deviceType = (DeviceType)buffer.ReadByte();
//        var clientIp = buffer.ReadString2() ?? string.Empty;
//        var sessionId = buffer.ReadInt64();
//        var accessHashKeyId = buffer.ReadInt64();

//        return new MessengerCommandDataReceivedEvent(connectionId, requestId, objectId, userId, reqMsgId, seqNumber, authKeyId, permAuthKeyId, data, layer, date, deviceType, clientIp, sessionId, accessHashKeyId);
//    }
//}
//public class MessengerDataReceivedEventRawDataSerializer : IRawDataSerializer<MessengerDataReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, MessengerDataReceivedEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.RequestId);
//        writer.Write(data.ObjectId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Layer);
//        writer.Write(data.Date);
//        writer.Write((byte)data.DeviceType);
//        writer.WriteString(data.ClientIp);
//        writer.Write(data.SessionId);
//        writer.Write(data.AccessHashKeyId);
//    }

//    public MessengerDataReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var requestId = buffer.ReadGuid();
//        var objectId = buffer.ReadUInt32();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var layer = buffer.ReadInt32();
//        var date = buffer.ReadInt64();
//        var deviceType = (DeviceType)buffer.ReadByte();
//        var clientIp = buffer.ReadString2() ?? string.Empty;
//        var sessionId = buffer.ReadInt64();
//        var accessHashKeyId = buffer.ReadInt64();

//        return new MessengerDataReceivedEvent(connectionId, requestId, objectId, userId, reqMsgId, seqNumber, authKeyId, permAuthKeyId, data, layer, date, deviceType, clientIp, sessionId, accessHashKeyId);
//    }
//}
//public class MessengerQueryDataReceivedEventRawDataSerializer : IRawDataSerializer<MessengerQueryDataReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, MessengerQueryDataReceivedEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.RequestId);
//        writer.Write(data.ObjectId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Layer);
//        writer.Write(data.Date);
//        writer.Write((byte)data.DeviceType);
//        writer.WriteString(data.ClientIp);
//        writer.Write(data.SessionId);
//        writer.Write(data.AccessHashKeyId);
//    }

//    public MessengerQueryDataReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var requestId = buffer.ReadGuid();
//        var objectId = buffer.ReadUInt32();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var layer = buffer.ReadInt32();
//        var date = buffer.ReadInt64();
//        var deviceType = (DeviceType)buffer.ReadByte();
//        var clientIp = buffer.ReadString2() ?? string.Empty;
//        var sessionId = buffer.ReadInt64();
//        var accessHashKeyId = buffer.ReadInt64();

//        return new MessengerQueryDataReceivedEvent(connectionId, requestId, objectId, userId, reqMsgId, seqNumber, authKeyId, permAuthKeyId, data, layer, date, deviceType, clientIp, sessionId, accessHashKeyId);
//    }
//}
//public class MtpMessageRawDataSerializer : IRawDataSerializer<MtpMessage>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, MtpMessage data)
//    {
//        writer.Write(data.ServerSalt);
//        writer.Write(data.SessionId);
//        writer.Write(data.MessageId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.MessageDataLength);
//        writer.Write(data.MessageData);
//    }

//    public MtpMessage Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var serverSalt = buffer.ReadInt64();
//        var sessionId = buffer.ReadInt64();
//        var messageId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var messageDataLength = buffer.ReadInt32();
//        var messageData = buffer.ReadMemory();

//        return new MtpMessage(serverSalt, sessionId, messageId, seqNumber, messageDataLength, messageData);
//    }
//}
//public class NewDeviceCreatedEventRawDataSerializer : IRawDataSerializer<NewDeviceCreatedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, NewDeviceCreatedEvent data)
//    {
//        writer.Write(data.RequestInfo);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.TempAuthKeyId);
//        writer.Write(data.UserId);
//        writer.Write(data.ApiId);
//        writer.WriteString(data.AppName);
//        writer.WriteString(data.AppVersion);
//        writer.Write(data.Hash);
//        writer.WriteBool(data.OfficialApp);
//        writer.WriteBool(data.PasswordPending);
//        writer.WriteString(data.DeviceModel);
//        writer.WriteString(data.Platform);
//        writer.WriteString(data.SystemVersion);
//        writer.WriteString(data.SystemLangCode);
//        writer.WriteString(data.LangPack);
//        writer.WriteString(data.LangCode);
//        writer.WriteString(data.Ip);
//        writer.Write(data.Layer);
//        writer.Write(data.Parameters);
//    }

//    public NewDeviceCreatedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var requestInfo = buffer.ReadRequestInfo();
//        var permAuthKeyId = buffer.ReadInt64();
//        var tempAuthKeyId = buffer.ReadInt64();
//        var userId = buffer.ReadInt64();
//        var apiId = buffer.ReadInt32();
//        var appName = buffer.ReadString2() ?? string.Empty;
//        var appVersion = buffer.ReadString2() ?? string.Empty;
//        var hash = buffer.ReadInt64();
//        var officialApp = buffer.ReadBoolean();
//        var passwordPending = buffer.ReadBoolean();
//        var deviceModel = buffer.ReadString2() ?? string.Empty;
//        var platform = buffer.ReadString2() ?? string.Empty;
//        var systemVersion = buffer.ReadString2() ?? string.Empty;
//        var systemLangCode = buffer.ReadString2() ?? string.Empty;
//        var langPack = buffer.ReadString2() ?? string.Empty;
//        var langCode = buffer.ReadString2() ?? string.Empty;
//        var ip = buffer.ReadString2() ?? string.Empty;
//        var layer = buffer.ReadInt32();
//        var parameters = buffer.ReadDictionary();

//        return new NewDeviceCreatedEvent(requestInfo, permAuthKeyId, tempAuthKeyId, userId, apiId, appName, appVersion, hash, officialApp, passwordPending, deviceModel, platform, systemVersion, systemLangCode, langPack, langCode, ip, layer, parameters);
//    }
//}
//public class NewPtsMessageHasSentEventRawDataSerializer : IRawDataSerializer<NewPtsMessageHasSentEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, NewPtsMessageHasSentEvent data)
//    {
//        writer.Write(data.UserId);
//        writer.Write(data.ToPeer);
//        writer.Write(data.MsgId);
//        writer.Write(data.TempAuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Pts);
//        writer.Write(data.GlobalSeqNo);
//        writer.Write(data.ReqMsgId);
//    }

//    public NewPtsMessageHasSentEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();
//        var toPeer = buffer.ReadPeer();
//        var msgId = buffer.ReadInt64();
//        var tempAuthKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var pts = buffer.ReadInt32();
//        var globalSeqNo = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();

//        return new NewPtsMessageHasSentEvent(userId, toPeer, msgId, tempAuthKeyId, permAuthKeyId, pts, globalSeqNo, reqMsgId);
//    }
//}
//public class NewQtsMessageHasSentEventRawDataSerializer : IRawDataSerializer<NewQtsMessageHasSentEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, NewQtsMessageHasSentEvent data)
//    {
//        writer.Write(data.UserId);
//        writer.Write(data.ToPeer);
//        writer.Write(data.MsgId);
//        writer.Write(data.TempAuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Qts);
//        writer.Write(data.GlobalSeqNo);
//        writer.Write(data.ReqMsgId);
//    }

//    public NewQtsMessageHasSentEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();
//        var toPeer = buffer.ReadPeer();
//        var msgId = buffer.ReadInt64();
//        var tempAuthKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var qts = buffer.ReadInt32();
//        var globalSeqNo = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();

//        return new NewQtsMessageHasSentEvent(userId, toPeer, msgId, tempAuthKeyId, permAuthKeyId, qts, globalSeqNo, reqMsgId);
//    }
//}
//public class NewWebPageCreatedEventRawDataSerializer : IRawDataSerializer<NewWebPageCreatedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, NewWebPageCreatedEvent data)
//    {
//        writer.Write(data.UserId);
//        writer.Write(data.PermAuthKeyId);
//        writer.WriteString(data.Url);
//        writer.Write(data.WebPageId);
//    }

//    public NewWebPageCreatedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var url = buffer.ReadString2() ?? string.Empty;
//        var webPageId = buffer.ReadInt64();

//        return new NewWebPageCreatedEvent(userId, permAuthKeyId, url, webPageId);
//    }
//}
//public class PhoneCallCacheItemRawDataSerializer : IRawDataSerializer<PhoneCallCacheItem>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, PhoneCallCacheItem data)
//    {
//        writer.Write(data.AdminId);
//        writer.Write(data.ParticipantId);
//        writer.Write(data.CallId);
//    }

//    public PhoneCallCacheItem Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var adminId = buffer.ReadInt64();
//        var participantId = buffer.ReadInt64();
//        var callId = buffer.ReadInt64();

//        return new PhoneCallCacheItem(adminId, participantId, callId);
//    }
//}
//public class PhoneCallDataReceivedEventRawDataSerializer : IRawDataSerializer<PhoneCallDataReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, PhoneCallDataReceivedEvent data)
//    {
//        writer.Write(data.ObjectId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Layer);
//    }

//    public PhoneCallDataReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var objectId = buffer.ReadUInt32();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var data = buffer.ReadBytes();
//        var layer = buffer.ReadInt32();

//        return new PhoneCallDataReceivedEvent(objectId, userId, reqMsgId, seqNumber, authKeyId, permAuthKeyId, data, layer);
//    }
//}
//public class PingTimeoutEventRawDataSerializer : IRawDataSerializer<PingTimeoutEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, PingTimeoutEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.AuthKeyId);
//    }

//    public PingTimeoutEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var authKeyId = buffer.ReadInt64();

//        return new PingTimeoutEvent(connectionId, authKeyId);
//    }
//}
//public class PushDataReceivedEventRawDataSerializer : IRawDataSerializer<PushDataReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, PushDataReceivedEvent data)
//    {
//        writer.Write(data.ObjectId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Layer);
//    }

//    public PushDataReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var objectId = buffer.ReadUInt32();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var layer = buffer.ReadInt32();

//        return new PushDataReceivedEvent(objectId, userId, reqMsgId, seqNumber, authKeyId, permAuthKeyId, data, layer);
//    }
//}
//public class PushMessageToPeerEventRawDataSerializer : IRawDataSerializer<PushMessageToPeerEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, PushMessageToPeerEvent data)
//    {
//        writer.Write(data.PeerType);
//        writer.Write(data.PeerId);
//        writer.Write(data.Data);
//        writer.Write(data.ExcludeAuthKeyId);
//        writer.Write(data.ExcludeUid);
//        writer.Write(data.OnlySendToThisAuthKeyId);
//        writer.Write(data.Pts);
//        writer.Write(data.GlobalSeqNo);
//    }

//    public PushMessageToPeerEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var peerType = buffer.ReadInt32();
//        var peerId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var excludeAuthKeyId = buffer.ReadInt64();
//        var excludeUid = buffer.ReadInt64();
//        var onlySendToThisAuthKeyId = buffer.ReadInt64();
//        var pts = buffer.ReadInt32();
//        var globalSeqNo = buffer.ReadInt64();

//        return new PushMessageToPeerEvent(peerType, peerId, data, excludeAuthKeyId, excludeUid, onlySendToThisAuthKeyId, pts, globalSeqNo);
//    }
//}
//public class PushNotificationCreatedEventRawDataSerializer : IRawDataSerializer<PushNotificationCreatedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, PushNotificationCreatedEvent data)
//    {
//        writer.Write(data.Data);
//    }

//    public PushNotificationCreatedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var data = buffer.ReadPushData();

//        return new PushNotificationCreatedEvent(data);
//    }
//}
//public class RawResponseRawDataSerializer : IRawDataSerializer<RawResponse>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, RawResponse data)
//    {
//        writer.Write(data.RawBytes);
//    }

//    public RawResponse Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var rawBytes = buffer.ReadBytes();

//        return new RawResponse(rawBytes);
//    }
//}
//public class RemoveCollectibleUsernameInputRawDataSerializer : IRawDataSerializer<RemoveCollectibleUsernameInput>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, RemoveCollectibleUsernameInput data)
//    {
//        writer.WriteString(data.UserName);
//    }

//    public RemoveCollectibleUsernameInput Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userName = buffer.ReadString2() ?? string.Empty;

//        return new RemoveCollectibleUsernameInput(userName);
//    }
//}
//public class ResetAuthorizationsInputRawDataSerializer : IRawDataSerializer<ResetAuthorizationsInput>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, ResetAuthorizationsInput data)
//    {
//        writer.Write(data.UserId);
//    }

//    public ResetAuthorizationsInput Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();

//        return new ResetAuthorizationsInput(userId);
//    }
//}
//public class RpcMessageHasSentEventRawDataSerializer : IRawDataSerializer<RpcMessageHasSentEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, RpcMessageHasSentEvent data)
//    {
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.UserId);
//        writer.Write(data.MsgId);
//        writer.Write(data.GlobalSeqNo);
//    }

//    public RpcMessageHasSentEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var reqMsgId = buffer.ReadInt64();
//        var userId = buffer.ReadInt64();
//        var msgId = buffer.ReadInt64();
//        var globalSeqNo = buffer.ReadInt64();

//        return new RpcMessageHasSentEvent(reqMsgId, userId, msgId, globalSeqNo);
//    }
//}
//public class SessionPasswordStateChangedEventRawDataSerializer : IRawDataSerializer<SessionPasswordStateChangedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, SessionPasswordStateChangedEvent data)
//    {
//        writer.Write(data.AuthKeyId);
//        writer.Write((byte)data.PasswordState);
//    }

//    public SessionPasswordStateChangedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var authKeyId = buffer.ReadInt64();
//        var passwordState = (PasswordState)buffer.ReadByte();

//        return new SessionPasswordStateChangedEvent(authKeyId, passwordState);
//    }
//}
//public class SessionRevokedEventRawDataSerializer : IRawDataSerializer<SessionRevokedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, SessionRevokedEvent data)
//    {
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.UserId);
//        writer.Write(data.RevokedPermAuthKeyIdList);
//    }

//    public SessionRevokedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var permAuthKeyId = buffer.ReadInt64();
//        var userId = buffer.ReadInt64();
//        var revokedPermAuthKeyIdList = buffer.ReadList();

//        return new SessionRevokedEvent(permAuthKeyId, userId, revokedPermAuthKeyIdList);
//    }
//}
//public class SetSessionPasswordStateEventRawDataSerializer : IRawDataSerializer<SetSessionPasswordStateEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, SetSessionPasswordStateEvent data)
//    {
//        writer.Write(data.UserId);
//        writer.Write((byte)data.PasswordState);
//    }

//    public SetSessionPasswordStateEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();
//        var passwordState = (PasswordState)buffer.ReadByte();

//        return new SetSessionPasswordStateEvent(userId, passwordState);
//    }
//}
//public class StickerDataReceivedEventRawDataSerializer : IRawDataSerializer<StickerDataReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, StickerDataReceivedEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.RequestId);
//        writer.Write(data.ObjectId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Layer);
//        writer.Write(data.Date);
//        writer.Write((byte)data.DeviceType);
//        writer.WriteString(data.ClientIp);
//        writer.Write(data.SessionId);
//        writer.Write(data.AccessHashKeyId);
//    }

//    public StickerDataReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var requestId = buffer.ReadGuid();
//        var objectId = buffer.ReadUInt32();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var layer = buffer.ReadInt32();
//        var date = buffer.ReadInt64();
//        var deviceType = (DeviceType)buffer.ReadByte();
//        var clientIp = buffer.ReadString2() ?? string.Empty;
//        var sessionId = buffer.ReadInt64();
//        var accessHashKeyId = buffer.ReadInt64();

//        return new StickerDataReceivedEvent(connectionId, requestId, objectId, userId, reqMsgId, seqNumber, authKeyId, permAuthKeyId, data, layer, date, deviceType, clientIp, sessionId, accessHashKeyId);
//    }
//}
//public class TakeoutCacheItemRawDataSerializer : IRawDataSerializer<TakeoutCacheItem>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, TakeoutCacheItem data)
//    {
//        writer.WriteBool(data.Contacts);
//        writer.WriteBool(data.MessageUsers);
//        writer.WriteBool(data.MessageChats);
//        writer.WriteBool(data.MessageMegagroups);
//        writer.WriteBool(data.MessageChannels);
//        writer.WriteBool(data.Files);
//        writer.Write(data.FileMaxSize);
//    }

//    public TakeoutCacheItem Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var contacts = buffer.ReadBoolean();
//        var messageUsers = buffer.ReadBoolean();
//        var messageChats = buffer.ReadBoolean();
//        var messageMegagroups = buffer.ReadBoolean();
//        var messageChannels = buffer.ReadBoolean();
//        var files = buffer.ReadBoolean();
//        var fileMaxSize = buffer.ReadNullableInt64();

//        return new TakeoutCacheItem(contacts, messageUsers, messageChats, messageMegagroups, messageChannels, files, fileMaxSize);
//    }
//}
//public class TransportErrorEventRawDataSerializer : IRawDataSerializer<TransportErrorEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, TransportErrorEvent data)
//    {
//        writer.Write(data.AuthKeyId);
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.TransportErrorCode);
//    }

//    public TransportErrorEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var authKeyId = buffer.ReadInt64();
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var transportErrorCode = buffer.ReadInt32();

//        return new TransportErrorEvent(authKeyId, connectionId, transportErrorCode);
//    }
//}
//public class UnRegisterAuthKeyEventRawDataSerializer : IRawDataSerializer<UnRegisterAuthKeyEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, UnRegisterAuthKeyEvent data)
//    {
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.UserId);
//    }

//    public UnRegisterAuthKeyEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var permAuthKeyId = buffer.ReadInt64();
//        var userId = buffer.ReadInt64();

//        return new UnRegisterAuthKeyEvent(permAuthKeyId, userId);
//    }
//}
//public class UpdatePtsForWebPageEventRawDataSerializer : IRawDataSerializer<UpdatePtsForWebPageEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, UpdatePtsForWebPageEvent data)
//    {
//        writer.Write(data.UserId);
//        writer.Write(data.PermAuthKeyId);
//        writer.WriteString(data.Url);
//        writer.Write(data.WebPageId);
//    }

//    public UpdatePtsForWebPageEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var url = buffer.ReadString2() ?? string.Empty;
//        var webPageId = buffer.ReadInt64();

//        return new UpdatePtsForWebPageEvent(userId, permAuthKeyId, url, webPageId);
//    }
//}
//public class UpdatesDataReceivedEventRawDataSerializer : IRawDataSerializer<UpdatesDataReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, UpdatesDataReceivedEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.RequestId);
//        writer.Write(data.ObjectId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Layer);
//        writer.Write(data.Date);
//        writer.Write((byte)data.DeviceType);
//        writer.WriteString(data.ClientIp);
//        writer.Write(data.SessionId);
//        writer.Write(data.AccessHashKeyId);
//    }

//    public UpdatesDataReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var requestId = buffer.ReadGuid();
//        var objectId = buffer.ReadUInt32();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var layer = buffer.ReadInt32();
//        var date = buffer.ReadInt64();
//        var deviceType = (DeviceType)buffer.ReadByte();
//        var clientIp = buffer.ReadString2() ?? string.Empty;
//        var sessionId = buffer.ReadInt64();
//        var accessHashKeyId = buffer.ReadInt64();

//        return new UpdatesDataReceivedEvent(connectionId, requestId, objectId, userId, reqMsgId, seqNumber, authKeyId, permAuthKeyId, data, layer, date, deviceType, clientIp, sessionId, accessHashKeyId);
//    }
//}
//public class UploadDataReceivedEventRawDataSerializer : IRawDataSerializer<UploadDataReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, UploadDataReceivedEvent data)
//    {
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.RequestId);
//        writer.Write(data.ObjectId);
//        writer.Write(data.UserId);
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.SeqNumber);
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.Data);
//        writer.Write(data.Layer);
//        writer.Write(data.Date);
//        writer.Write((byte)data.DeviceType);
//        writer.WriteString(data.ClientIp);
//        writer.Write(data.SessionId);
//        writer.Write(data.AccessHashKeyId);
//    }

//    public UploadDataReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var requestId = buffer.ReadGuid();
//        var objectId = buffer.ReadUInt32();
//        var userId = buffer.ReadInt64();
//        var reqMsgId = buffer.ReadInt64();
//        var seqNumber = buffer.ReadInt32();
//        var authKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var layer = buffer.ReadInt32();
//        var date = buffer.ReadInt64();
//        var deviceType = (DeviceType)buffer.ReadByte();
//        var clientIp = buffer.ReadString2() ?? string.Empty;
//        var sessionId = buffer.ReadInt64();
//        var accessHashKeyId = buffer.ReadInt64();

//        return new UploadDataReceivedEvent(connectionId, requestId, objectId, userId, reqMsgId, seqNumber, authKeyId, permAuthKeyId, data, layer, date, deviceType, clientIp, sessionId, accessHashKeyId);
//    }
//}
//public class UserIsOnlineEventRawDataSerializer : IRawDataSerializer<UserIsOnlineEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, UserIsOnlineEvent data)
//    {
//        writer.Write(data.UserId);
//        writer.Write(data.TempAuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//    }

//    public UserIsOnlineEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();
//        var tempAuthKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();

//        return new UserIsOnlineEvent(userId, tempAuthKeyId, permAuthKeyId);
//    }
//}
//public class UserLoggedOutEventRawDataSerializer : IRawDataSerializer<UserLoggedOutEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, UserLoggedOutEvent data)
//    {
//        writer.Write(data.UserId);
//        writer.Write(data.TempAuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//    }

//    public UserLoggedOutEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var userId = buffer.ReadInt64();
//        var tempAuthKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();

//        return new UserLoggedOutEvent(userId, tempAuthKeyId, permAuthKeyId);
//    }
//}
//public class UserSignInSuccessEventRawDataSerializer : IRawDataSerializer<UserSignInSuccessEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, UserSignInSuccessEvent data)
//    {
//        writer.Write(data.ReqMsgId);
//        writer.Write(data.TempAuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.UserId);
//        writer.Write((byte)data.PasswordState);
//        writer.WriteBool(data.SendRpcErrorToClient);
//    }

//    public UserSignInSuccessEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var reqMsgId = buffer.ReadInt64();
//        var tempAuthKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var userId = buffer.ReadInt64();
//        var passwordState = (PasswordState)buffer.ReadByte();
//        var sendRpcErrorToClient = buffer.ReadBoolean();

//        return new UserSignInSuccessEvent(reqMsgId, tempAuthKeyId, permAuthKeyId, userId, passwordState, sendRpcErrorToClient);
//    }
//}
//public class UserSignUpSuccessIntegrationEventRawDataSerializer : IRawDataSerializer<UserSignUpSuccessIntegrationEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, UserSignUpSuccessIntegrationEvent data)
//    {
//        writer.Write(data.TempAuthKeyId);
//        writer.Write(data.PermAuthKeyId);
//        writer.Write(data.UserId);
//    }

//    public UserSignUpSuccessIntegrationEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var tempAuthKeyId = buffer.ReadInt64();
//        var permAuthKeyId = buffer.ReadInt64();
//        var userId = buffer.ReadInt64();

//        return new UserSignUpSuccessIntegrationEvent(tempAuthKeyId, permAuthKeyId, userId);
//    }
//}
//public class WebAdminCommand2ReceivedEventRawDataSerializer : IRawDataSerializer<WebAdminCommand2ReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, WebAdminCommand2ReceivedEvent data)
//    {
//        writer.Write((byte)data.CommandType);
//        writer.WriteString(data.Data);
//    }

//    public WebAdminCommand2ReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var commandType = (WebAdminCommandType)buffer.ReadByte();
//        var data = buffer.ReadString2();

//        return new WebAdminCommand2ReceivedEvent(commandType, data);
//    }
//}
//public class WebAdminCommandReceivedEventRawDataSerializer : IRawDataSerializer<WebAdminCommandReceivedEvent>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, WebAdminCommandReceivedEvent data)
//    {
//        writer.Write((byte)data.CommandType);
//        writer.WriteString(data.Data);
//    }

//    public WebAdminCommandReceivedEvent Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var commandType = (WebAdminCommandType)buffer.ReadByte();
//        var data = buffer.ReadString2();

//        return new WebAdminCommandReceivedEvent(commandType, data);
//    }
//}
//// MyTelegram.Abstractions
//public class EncryptedMessageRawDataSerializer : IRawDataSerializer<EncryptedMessage>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, EncryptedMessage data)
//    {
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.MsgKey);
//        writer.Write(data.EncryptedData);
//        writer.WriteString(data.ConnectionId);
//        writer.Write((byte)data.ConnectionType);
//        writer.WriteString(data.ClientIp);
//        writer.Write(data.RequestId);
//        writer.Write(data.Date);
//    }

//    public EncryptedMessage Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var authKeyId = buffer.ReadInt64();
//        var msgKey = buffer.ReadMemory();
//        var encryptedData = buffer.ReadMemory();
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var connectionType = (ConnectionType)buffer.ReadByte();
//        var clientIp = buffer.ReadString2() ?? string.Empty;
//        var requestId = buffer.ReadGuid();
//        var date = buffer.ReadInt64();
//        var owner = MemoryPool<byte>.Shared.Rent(msgKey.Length + encryptedData.Length);
//        var memory = owner.Memory;
//        var msgKeyMemory = memory.Slice(0, msgKey.Length);
//        var encryptedDataMemory = memory.Slice(msgKey.Length, encryptedData.Length);
//        msgKey.CopyTo(msgKeyMemory);
//        encryptedData.CopyTo(encryptedDataMemory);

//        return new EncryptedMessage(authKeyId, msgKeyMemory, encryptedDataMemory, connectionId, connectionType, clientIp, requestId, date)
//        {
//            MemoryOwner = owner
//        };

//        //return new EncryptedMessage(authKeyId, msgKey, encryptedData, connectionId, connectionType, clientIp, requestId, date);
//    }
//}
//public class EncryptedMessageResponseRawDataSerializer : IRawDataSerializer<EncryptedMessageResponse>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, EncryptedMessageResponse data)
//    {
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.Data);
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.SeqNumber);
//    }

//    public EncryptedMessageResponse Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var authKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var seqNumber = buffer.ReadInt64();

//        return new EncryptedMessageResponse(authKeyId, data, connectionId, seqNumber);
//    }
//}
//public class UnencryptedMessageRawDataSerializer : IRawDataSerializer<UnencryptedMessage>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, UnencryptedMessage data)
//    {
//        writer.Write(data.AuthKeyId);
//        writer.WriteString(data.ClientIp);
//        writer.WriteString(data.ConnectionId);
//        writer.Write((byte)data.ConnectionType);
//        writer.Write(data.MessageData);
//        writer.Write(data.MessageDataLength);
//        writer.Write(data.MessageId);
//        writer.Write(data.ObjectId);
//        writer.Write(data.RequestId);
//        writer.Write(data.Date);
//    }

//    public UnencryptedMessage Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var authKeyId = buffer.ReadInt64();
//        var clientIp = buffer.ReadString2() ?? string.Empty;
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var connectionType = (ConnectionType)buffer.ReadByte();
//        var messageData = buffer.ReadMemory();
//        var messageDataLength = buffer.ReadInt32();
//        var messageId = buffer.ReadInt64();
//        var objectId = buffer.ReadUInt32();
//        var requestId = buffer.ReadGuid();
//        var date = buffer.ReadInt64();

//        return new UnencryptedMessage(authKeyId, clientIp, connectionId, connectionType, messageData, messageDataLength, messageId, objectId, requestId, date);
//    }
//}
//public class UnencryptedMessageResponseRawDataSerializer : IRawDataSerializer<UnencryptedMessageResponse>, ITransientDependency
//{
//    public object? Deserialize2(Type type, ReadOnlyMemory<byte> buffer)
//    {
//        return Deserialize(buffer);
//    }
//    public void Serialize(IBufferWriter<byte> writer, UnencryptedMessageResponse data)
//    {
//        writer.Write(data.AuthKeyId);
//        writer.Write(data.Data);
//        writer.WriteString(data.ConnectionId);
//        writer.Write(data.ReqMsgId);
//    }

//    public UnencryptedMessageResponse Deserialize(ReadOnlyMemory<byte> buffer)
//    {
//        var authKeyId = buffer.ReadInt64();
//        var data = buffer.ReadMemory();
//        var connectionId = buffer.ReadString2() ?? string.Empty;
//        var reqMsgId = buffer.ReadInt64();

//        return new UnencryptedMessageResponse(authKeyId, data, connectionId, reqMsgId);
//    }
//}
