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

namespace MyTelegram.Schema;

///<summary>
/// Message entity <a href="https://corefork.telegram.org/api/mentions">mentioning</a> a user by <code>@username</code>; <a href="https://corefork.telegram.org/constructor/messageEntityMentionName">messageEntityMentionName</a> can also be used to mention users by their ID.
/// See <a href="https://corefork.telegram.org/constructor/messageEntityMention" />
///</summary>
[TlObject(0xfa04579d)]
public sealed class TMessageEntityMention : IMessageEntity
{
    public uint ConstructorId => 0xfa04579d;
    ///<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; }

    public void ComputeFlag()
    {

    }

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

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