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

namespace MyTelegram.Schema.Bots;

///<summary>
/// Activate or deactivate a purchased <a href="https://fragment.com/">fragment.com</a> username associated to a bot we own.
/// <para>Possible errors</para>
/// Code Type Description
/// 400 BOT_INVALID This is not a valid bot.
/// 400 USERNAME_NOT_MODIFIED The username was not modified.
/// See <a href="https://corefork.telegram.org/method/bots.toggleUsername" />
///</summary>
[TlObject(0x53ca973)]
public sealed class RequestToggleUsername : IRequest<IBool>
{
    public uint ConstructorId => 0x53ca973;
    ///<summary>
    /// The bot
    /// See <a href="https://corefork.telegram.org/type/InputUser" />
    ///</summary>
    public MyTelegram.Schema.IInputUser Bot { get; set; }

    ///<summary>
    /// Username
    ///</summary>
    public string Username { get; set; }

    ///<summary>
    /// Whether to activate or deactivate it
    /// See <a href="https://corefork.telegram.org/type/Bool" />
    ///</summary>
    public bool Active { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Bot);
        writer.Write(Username);
        writer.Write(Active);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Bot = buffer.Read<MyTelegram.Schema.IInputUser>();
        Username = buffer.ReadString();
        Active = buffer.Read();
    }
}
