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

namespace MyTelegram.Schema.Messages;

///<summary>
/// Get dialogs manually marked as unread
/// See <a href="https://corefork.telegram.org/method/messages.getDialogUnreadMarks" />
///</summary>
[TlObject(0x21202222)]
public sealed class RequestGetDialogUnreadMarks : IRequest<TVector<MyTelegram.Schema.IDialogPeer>>
{
    public uint ConstructorId => 0x21202222;
    public int Flags { get; set; }
    public MyTelegram.Schema.IInputPeer? ParentPeer { get; set; }

    public void ComputeFlag()
    {
        if (ParentPeer != null) { Flags = Flags.SetBit(0); }
    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Flags);
        if (Flags.IsBitSet(0)) { writer.Write(ParentPeer); }
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Flags = buffer.ReadInt32();
        if (Flags.IsBitSet(0)) { ParentPeer = buffer.Read<MyTelegram.Schema.IInputPeer>(); }
    }
}
