// <auto-generated/>
// ReSharper disable All

namespace MyTelegram.Schema.Updates;

///<summary>
/// Full list of occurred events.
/// See <a href="https://corefork.telegram.org/constructor/updates.difference" />
///</summary>
[TlObject(0xf49ca0)]
public sealed class TDifference : IDifference
{
    public uint ConstructorId => 0xf49ca0;
    ///<summary>
    /// List of new messages
    ///</summary>
    public TVector<MyTelegram.Schema.IMessage> NewMessages { get; set; }

    ///<summary>
    /// List of new encrypted secret chat messages
    ///</summary>
    public TVector<MyTelegram.Schema.IEncryptedMessage> NewEncryptedMessages { get; set; }

    ///<summary>
    /// List of updates
    ///</summary>
    public TVector<MyTelegram.Schema.IUpdate> OtherUpdates { get; set; }

    ///<summary>
    /// List of chats mentioned in events
    ///</summary>
    public TVector<MyTelegram.Schema.IChat> Chats { get; set; }

    ///<summary>
    /// List of users mentioned in events
    ///</summary>
    public TVector<MyTelegram.Schema.IUser> Users { get; set; }

    ///<summary>
    /// Current state
    /// See <a href="https://corefork.telegram.org/type/updates.State" />
    ///</summary>
    public MyTelegram.Schema.Updates.IState State { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(NewMessages);
        writer.Write(NewEncryptedMessages);
        writer.Write(OtherUpdates);
        writer.Write(Chats);
        writer.Write(Users);
        writer.Write(State);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        NewMessages = buffer.Read<TVector<MyTelegram.Schema.IMessage>>();
        NewEncryptedMessages = buffer.Read<TVector<MyTelegram.Schema.IEncryptedMessage>>();
        OtherUpdates = buffer.Read<TVector<MyTelegram.Schema.IUpdate>>();
        Chats = buffer.Read<TVector<MyTelegram.Schema.IChat>>();
        Users = buffer.Read<TVector<MyTelegram.Schema.IUser>>();
        State = buffer.Read<MyTelegram.Schema.Updates.IState>();
    }
}