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

namespace MyTelegram.Schema;

///<summary>
/// Public key to use <strong>only</strong> during handshakes to <a href="https://corefork.telegram.org/cdn">CDN</a> DCs.
/// See <a href="https://corefork.telegram.org/constructor/cdnPublicKey" />
///</summary>
[TlObject(0xc982eaba)]
public sealed class TCdnPublicKey : ICdnPublicKey
{
    public uint ConstructorId => 0xc982eaba;
    ///<summary>
    /// <a href="https://corefork.telegram.org/cdn">CDN DC</a> ID
    ///</summary>
    public int DcId { get; set; }

    ///<summary>
    /// RSA public key
    ///</summary>
    public string PublicKey { get; set; }

    public void ComputeFlag()
    {

    }

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

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