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

namespace MyTelegram.Schema.Account.LayerN;

///<summary>
/// Register device to receive <a href="https://corefork.telegram.org/api/push-updates">PUSH notifications</a>
/// <para>Possible errors</para>
/// Code Type Description
/// 400 TOKEN_EMPTY The specified token is empty.
/// 400 TOKEN_INVALID The provided token is invalid.
/// 400 TOKEN_TYPE_INVALID The specified token type is invalid.
/// 400 WEBPUSH_AUTH_INVALID The specified web push authentication secret is invalid.
/// 400 WEBPUSH_KEY_INVALID The specified web push elliptic curve Diffie-Hellman public key is invalid.
/// 400 WEBPUSH_TOKEN_INVALID The specified web push token is invalid.
/// See <a href="https://corefork.telegram.org/method/account.registerDevice" />
///</summary>
[TlObject(0x637ea878)]
public sealed class RequestRegisterDevice : IRequest<IBool>
{
    public uint ConstructorId => 0x637ea878;
    ///<summary>
    /// Device token type, see <a href="https://corefork.telegram.org/api/push-updates#subscribing-to-notifications">PUSH updates</a> for the possible values.
    ///</summary>
    public int TokenType { get; set; }

    ///<summary>
    /// Device token, see <a href="https://corefork.telegram.org/api/push-updates#subscribing-to-notifications">PUSH updates</a> for the possible values.
    ///</summary>
    public string Token { get; set; }

    public void ComputeFlag()
    {

    }

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

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