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

namespace MyTelegram.Schema.Messages;

///<summary>
/// Start a conversation with a bot using a <a href="https://corefork.telegram.org/api/links#bot-links">deep linking parameter</a>
/// <para>Possible errors</para>
/// Code Type Description
/// 400 BOT_INVALID This is not a valid bot.
/// 400 CHAT_ADMIN_REQUIRED You must be an admin in this chat to do this.
/// 403 CHAT_WRITE_FORBIDDEN You can't write in this chat.
/// 400 INPUT_USER_DEACTIVATED The specified user was deleted.
/// 400 MSG_ID_INVALID Invalid message ID provided.
/// 400 PEER_ID_INVALID The provided peer id is invalid.
/// 500 RANDOM_ID_DUPLICATE You provided a random ID that was already used.
/// 400 START_PARAM_EMPTY The start parameter is empty.
/// 400 START_PARAM_INVALID Start parameter invalid.
/// 400 START_PARAM_TOO_LONG Start parameter is too long.
/// See <a href="https://corefork.telegram.org/method/messages.startBot" />
///</summary>
[TlObject(0xe6df7378)]
public sealed class RequestStartBot : IRequest<MyTelegram.Schema.IUpdates>
{
    public uint ConstructorId => 0xe6df7378;
    ///<summary>
    /// The bot
    /// See <a href="https://corefork.telegram.org/type/InputUser" />
    ///</summary>
    public MyTelegram.Schema.IInputUser Bot { get; set; }

    ///<summary>
    /// The chat where to start the bot, can be the bot's private chat or a group
    /// See <a href="https://corefork.telegram.org/type/InputPeer" />
    ///</summary>
    public MyTelegram.Schema.IInputPeer Peer { get; set; }

    ///<summary>
    /// Random ID to avoid resending the same message
    ///</summary>
    public long RandomId { get; set; }

    ///<summary>
    /// <a href="https://corefork.telegram.org/api/links#bot-links">Deep linking parameter</a>
    ///</summary>
    public string StartParam { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Bot);
        writer.Write(Peer);
        writer.Write(RandomId);
        writer.Write(StartParam);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Bot = buffer.Read<MyTelegram.Schema.IInputUser>();
        Peer = buffer.Read<MyTelegram.Schema.IInputPeer>();
        RandomId = buffer.ReadInt64();
        StartParam = buffer.ReadString();
    }
}
