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

namespace MyTelegram.Schema.Account;

///<summary>
/// See <a href="https://corefork.telegram.org/method/account.addNoPaidMessagesException" />
///</summary>
[TlObject(0x6f688aa7)]
public sealed class RequestAddNoPaidMessagesException : IRequest<IBool>
{
    public uint ConstructorId => 0x6f688aa7;
    public int Flags { get; set; }
    public bool RefundCharged { get; set; }
    public MyTelegram.Schema.IInputUser UserId { get; set; }

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

    }

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

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