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

namespace MyTelegram.Schema.Messages;

///<summary>
/// Mark a <a href="https://corefork.telegram.org/api/threads">thread</a> as read
/// <para>Possible errors</para>
/// Code Type Description
/// 400 CHAT_ID_INVALID The provided chat id is invalid.
/// 400 MSG_ID_INVALID Invalid message ID provided.
/// 400 PEER_ID_INVALID The provided peer id is invalid.
/// See <a href="https://corefork.telegram.org/method/messages.readDiscussion" />
///</summary>
[TlObject(0xf731a9f4)]
public sealed class RequestReadDiscussion : IRequest<IBool>
{
    public uint ConstructorId => 0xf731a9f4;
    ///<summary>
    /// Group ID
    /// See <a href="https://corefork.telegram.org/type/InputPeer" />
    ///</summary>
    public MyTelegram.Schema.IInputPeer Peer { get; set; }

    ///<summary>
    /// ID of message that started the thread
    ///</summary>
    public int MsgId { get; set; }

    ///<summary>
    /// ID up to which thread messages were read
    ///</summary>
    public int ReadMaxId { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Peer);
        writer.Write(MsgId);
        writer.Write(ReadMaxId);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Peer = buffer.Read<MyTelegram.Schema.IInputPeer>();
        MsgId = buffer.ReadInt32();
        ReadMaxId = buffer.ReadInt32();
    }
}
