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

namespace MyTelegram.Schema.Channels;

///<summary>
/// Globally search for posts from public <a href="https://corefork.telegram.org/api/channel">channels »</a> (<em>including</em> those we aren't a member of) containing a specific hashtag.
/// See <a href="https://corefork.telegram.org/method/channels.searchPosts" />
///</summary>
[TlObject(0xd19f987b)]
public sealed class RequestSearchPosts : IRequest<MyTelegram.Schema.Messages.IMessages>
{
    public uint ConstructorId => 0xd19f987b;
    ///<summary>
    /// The hashtag to search, without the <code>#</code> character.
    ///</summary>
    public string Hashtag { get; set; }

    ///<summary>
    /// Initially 0, then set to the <a href="https://corefork.telegram.org/constructor/messages.messagesSlice"><code>next_rate</code> parameter of messages.messagesSlice</a>
    ///</summary>
    public int OffsetRate { get; set; }

    ///<summary>
    /// <a href="https://corefork.telegram.org/api/offsets">Offsets for pagination, for more info click here</a>
    /// See <a href="https://corefork.telegram.org/type/InputPeer" />
    ///</summary>
    public MyTelegram.Schema.IInputPeer OffsetPeer { get; set; }

    ///<summary>
    /// <a href="https://corefork.telegram.org/api/offsets">Offsets for pagination, for more info click here</a>
    ///</summary>
    public int OffsetId { get; set; }

    ///<summary>
    /// Maximum number of results to return, <a href="https://corefork.telegram.org/api/offsets">see pagination</a>
    ///</summary>
    public int Limit { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Hashtag);
        writer.Write(OffsetRate);
        writer.Write(OffsetPeer);
        writer.Write(OffsetId);
        writer.Write(Limit);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Hashtag = buffer.ReadString();
        OffsetRate = buffer.ReadInt32();
        OffsetPeer = buffer.Read<MyTelegram.Schema.IInputPeer>();
        OffsetId = buffer.ReadInt32();
        Limit = buffer.ReadInt32();
    }
}
