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

namespace MyTelegram.Schema;

///<summary>
/// Message entity representing a preformatted <code>codeblock</code>, allowing the user to specify a programming language for the codeblock.
/// See <a href="https://corefork.telegram.org/constructor/messageEntityPre" />
///</summary>
[TlObject(0x73924be0)]
public sealed class TMessageEntityPre : IMessageEntity
{
    public uint ConstructorId => 0x73924be0;
    ///<summary>
    /// Offset of message entity within message (in <a href="https://corefork.telegram.org/api/entities#entity-length">UTF-16 code units</a>)
    ///</summary>
    public int Offset { get; set; }

    ///<summary>
    /// Length of message entity within message (in <a href="https://corefork.telegram.org/api/entities#entity-length">UTF-16 code units</a>)
    ///</summary>
    public int Length { get; set; }

    ///<summary>
    /// Programming language of the code
    ///</summary>
    public string Language { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Offset);
        writer.Write(Length);
        writer.Write(Language);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Offset = buffer.ReadInt32();
        Length = buffer.ReadInt32();
        Language = buffer.ReadString();
    }
}