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

namespace MyTelegram.Schema.Account;

///<summary>
/// Sends a Telegram Passport authorization form, effectively sharing data with the service
/// <para>Possible errors</para>
/// Code Type Description
/// 400 BOT_INVALID This is not a valid bot.
/// 400 PUBLIC_KEY_REQUIRED A public key is required.
/// See <a href="https://corefork.telegram.org/method/account.acceptAuthorization" />
///</summary>
[TlObject(0xf3ed4c73)]
public sealed class RequestAcceptAuthorization : IRequest<IBool>
{
    public uint ConstructorId => 0xf3ed4c73;
    ///<summary>
    /// Bot ID
    ///</summary>
    public long BotId { get; set; }

    ///<summary>
    /// Telegram Passport element types requested by the service
    ///</summary>
    public string Scope { get; set; }

    ///<summary>
    /// Service's public key
    ///</summary>
    public string PublicKey { get; set; }

    ///<summary>
    /// Types of values sent and their hashes
    ///</summary>
    public TVector<MyTelegram.Schema.ISecureValueHash> ValueHashes { get; set; }

    ///<summary>
    /// Encrypted values
    /// See <a href="https://corefork.telegram.org/type/SecureCredentialsEncrypted" />
    ///</summary>
    public MyTelegram.Schema.ISecureCredentialsEncrypted Credentials { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(BotId);
        writer.Write(Scope);
        writer.Write(PublicKey);
        writer.Write(ValueHashes);
        writer.Write(Credentials);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        BotId = buffer.ReadInt64();
        Scope = buffer.ReadString();
        PublicKey = buffer.ReadString();
        ValueHashes = buffer.Read<TVector<MyTelegram.Schema.ISecureValueHash>>();
        Credentials = buffer.Read<MyTelegram.Schema.ISecureCredentialsEncrypted>();
    }
}
