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

namespace MyTelegram.Schema.Account;

///<summary>
/// Securely save <a href="https://corefork.telegram.org/passport">Telegram Passport</a> document, <a href="https://corefork.telegram.org/passport/encryption#encryption">for more info see the passport docs »</a>
/// <para>Possible errors</para>
/// Code Type Description
/// 400 PASSWORD_REQUIRED A <a href="https://corefork.telegram.org/api/srp">2FA password</a> must be configured to use Telegram Passport.
/// 400 SECURE_SECRET_REQUIRED A secure secret is required.
/// See <a href="https://corefork.telegram.org/method/account.saveSecureValue" />
///</summary>
[TlObject(0x899fe31d)]
public sealed class RequestSaveSecureValue : IRequest<MyTelegram.Schema.ISecureValue>
{
    public uint ConstructorId => 0x899fe31d;
    ///<summary>
    /// Secure value, <a href="https://corefork.telegram.org/passport/encryption#encryption">for more info see the passport docs »</a>
    /// See <a href="https://corefork.telegram.org/type/InputSecureValue" />
    ///</summary>
    public MyTelegram.Schema.IInputSecureValue Value { get; set; }

    ///<summary>
    /// Passport secret hash, <a href="https://corefork.telegram.org/passport/encryption#encryption">for more info see the passport docs »</a>
    ///</summary>
    public long SecureSecretId { get; set; }

    public void ComputeFlag()
    {

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Value = buffer.Read<MyTelegram.Schema.IInputSecureValue>();
        SecureSecretId = buffer.ReadInt64();
    }
}
