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

namespace MyTelegram.Schema;

///<summary>
/// Nearest data center, according to geo-ip.
/// See <a href="https://corefork.telegram.org/constructor/nearestDc" />
///</summary>
[TlObject(0x8e1a1775)]
public sealed class TNearestDc : INearestDc
{
    public uint ConstructorId => 0x8e1a1775;
    ///<summary>
    /// Country code determined by geo-ip
    ///</summary>
    public string Country { get; set; }

    ///<summary>
    /// Number of current data center
    ///</summary>
    public int ThisDc { get; set; }

    ///<summary>
    /// Number of nearest data center
    ///</summary>
    public int NearestDc { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Country);
        writer.Write(ThisDc);
        writer.Write(NearestDc);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Country = buffer.ReadString();
        ThisDc = buffer.ReadInt32();
        NearestDc = buffer.ReadInt32();
    }
}