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

namespace MyTelegram.Schema;

///<summary>
/// See <a href="https://corefork.telegram.org/constructor/updateMonoForumNoPaidException" />
///</summary>
[TlObject(0x9f812b08)]
public sealed class TUpdateMonoForumNoPaidException : IUpdate
{
    public uint ConstructorId => 0x9f812b08;
    public int Flags { get; set; }
    public bool Exception { get; set; }
    public long ChannelId { get; set; }
    public MyTelegram.Schema.IPeer SavedPeerId { get; set; }

    public void ComputeFlag()
    {
        if (Exception) { Flags = Flags.SetBit(0); }

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Flags);
        writer.Write(ChannelId);
        writer.Write(SavedPeerId);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Flags = buffer.ReadInt32();
        if (Flags.IsBitSet(0)) { Exception = true; }
        ChannelId = buffer.ReadInt64();
        SavedPeerId = buffer.Read<MyTelegram.Schema.IPeer>();
    }
}