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

namespace MyTelegram.Schema.Payments;

///<summary>
/// See <a href="https://corefork.telegram.org/method/payments.toggleChatStarGiftNotifications" />
///</summary>
[TlObject(0x60eaefa1)]
public sealed class RequestToggleChatStarGiftNotifications : IRequest<IBool>
{
    public uint ConstructorId => 0x60eaefa1;
    public int Flags { get; set; }
    public bool Enabled { get; set; }
    public MyTelegram.Schema.IInputPeer Peer { get; set; }

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

    }

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

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