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

namespace MyTelegram.Schema.Messages;

///<summary>
/// Incomplete list of dialogs with messages and auxiliary data.
/// See <a href="https://corefork.telegram.org/constructor/messages.dialogsSlice" />
///</summary>
[TlObject(0x71e094f3)]
public sealed class TDialogsSlice : IDialogs
{
    public uint ConstructorId => 0x71e094f3;
    ///<summary>
    /// Total number of dialogs
    ///</summary>
    public int Count { get; set; }

    ///<summary>
    /// List of dialogs
    ///</summary>
    public TVector<MyTelegram.Schema.IDialog> Dialogs { get; set; }

    ///<summary>
    /// List of last messages from dialogs
    ///</summary>
    public TVector<MyTelegram.Schema.IMessage> Messages { get; set; }

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

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

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Count);
        writer.Write(Dialogs);
        writer.Write(Messages);
        writer.Write(Chats);
        writer.Write(Users);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Count = buffer.ReadInt32();
        Dialogs = buffer.Read<TVector<MyTelegram.Schema.IDialog>>();
        Messages = buffer.Read<TVector<MyTelegram.Schema.IMessage>>();
        Chats = buffer.Read<TVector<MyTelegram.Schema.IChat>>();
        Users = buffer.Read<TVector<MyTelegram.Schema.IUser>>();
    }
}