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

namespace MyTelegram.Schema.Auth;

///<summary>
/// Logs in a user using a key transmitted from his native data-center.
/// <para>Possible errors</para>
/// Code Type Description
/// 400 AUTH_BYTES_INVALID The provided authorization is invalid.
/// 400 USER_ID_INVALID The provided user ID is invalid.
/// See <a href="https://corefork.telegram.org/method/auth.importAuthorization" />
///</summary>
[TlObject(0xa57a7dad)]
public sealed class RequestImportAuthorization : IRequest<MyTelegram.Schema.Auth.IAuthorization>
{
    public uint ConstructorId => 0xa57a7dad;
    ///<summary>
    /// User ID
    ///</summary>
    public long Id { get; set; }

    ///<summary>
    /// Authorization key
    ///</summary>
    public byte[] Bytes { get; set; }

    public void ComputeFlag()
    {

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Id = buffer.ReadInt64();
        Bytes = buffer.ReadBytes();
    }
}
