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

namespace MyTelegram.Schema;

///<summary>
/// See <a href="https://corefork.telegram.org/constructor/messageActionPaidMessagesPrice" />
///</summary>
[TlObject(0x84b88578)]
public sealed class TMessageActionPaidMessagesPrice : IMessageAction
{
    public uint ConstructorId => 0x84b88578;
    public int Flags { get; set; }
    public bool BroadcastMessagesAllowed { get; set; }
    public long Stars { get; set; }

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

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Flags = buffer.ReadInt32();
        if (Flags.IsBitSet(0)) { BroadcastMessagesAllowed = true; }
        Stars = buffer.ReadInt64();
    }
}