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

namespace MyTelegram.Schema.Account;

///<summary>
/// Validates a username and checks availability.
/// <para>Possible errors</para>
/// Code Type Description
/// 400 USERNAME_INVALID The provided username is not valid.
/// 400 USERNAME_OCCUPIED The provided username is already occupied.
/// 400 USERNAME_PURCHASE_AVAILABLE The specified username can be purchased on <a href="https://fragment.com/">https://fragment.com</a>.
/// See <a href="https://corefork.telegram.org/method/account.checkUsername" />
///</summary>
[TlObject(0x2714d86c)]
public sealed class RequestCheckUsername : IRequest<IBool>
{
    public uint ConstructorId => 0x2714d86c;
    ///<summary>
    /// username<br>Accepted characters: A-z (case-insensitive), 0-9 and underscores.<br>Length: 5-32 characters.
    ///</summary>
    public string Username { get; set; }

    public void ComputeFlag()
    {

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Username = buffer.ReadString();
    }
}
