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

namespace MyTelegram.Schema.Messages;

///<summary>
/// Get chats in common with a user
/// <para>Possible errors</para>
/// Code Type Description
/// 400 MSG_ID_INVALID Invalid message ID provided.
/// 400 USER_ID_INVALID The provided user ID is invalid.
/// See <a href="https://corefork.telegram.org/method/messages.getCommonChats" />
///</summary>
[TlObject(0xe40ca104)]
public sealed class RequestGetCommonChats : IRequest<MyTelegram.Schema.Messages.IChats>
{
    public uint ConstructorId => 0xe40ca104;
    ///<summary>
    /// User ID
    /// See <a href="https://corefork.telegram.org/type/InputUser" />
    ///</summary>
    public MyTelegram.Schema.IInputUser UserId { get; set; }

    ///<summary>
    /// Maximum ID of chat to return (see <a href="https://corefork.telegram.org/api/offsets">pagination</a>)
    ///</summary>
    public long MaxId { 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(UserId);
        writer.Write(MaxId);
        writer.Write(Limit);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        UserId = buffer.Read<MyTelegram.Schema.IInputUser>();
        MaxId = buffer.ReadInt64();
        Limit = buffer.ReadInt32();
    }
}
