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

namespace MyTelegram.Schema.Messages;

///<summary>
/// See <a href="https://corefork.telegram.org/constructor/messages.foundStickersNotModified" />
///</summary>
[TlObject(0x6010c534)]
public sealed class TFoundStickersNotModified : IFoundStickers
{
    public uint ConstructorId => 0x6010c534;
    ///<summary>
    /// Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a>
    ///</summary>
    public int Flags { get; set; }

    ///<summary>
    /// &nbsp;
    ///</summary>
    public int? NextOffset { get; set; }

    public void ComputeFlag()
    {
        if (/*NextOffset != 0 && */NextOffset.HasValue) { Flags = Flags.SetBit(0); }
    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Flags);
        if (Flags.IsBitSet(0)) { writer.Write(NextOffset.Value); }
    }

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