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

namespace MyTelegram.Schema;

///<summary>
/// A possible answer of a poll
/// See <a href="https://corefork.telegram.org/constructor/pollAnswer" />
///</summary>
[TlObject(0xff16e2ca)]
public sealed class TPollAnswer : IPollAnswer
{
    public uint ConstructorId => 0xff16e2ca;
    ///<summary>
    /// Textual representation of the answer (only <a href="https://corefork.telegram.org/api/premium">Premium</a> users can use <a href="https://corefork.telegram.org/api/custom-emoji">custom emoji entities</a> here).
    /// See <a href="https://corefork.telegram.org/type/TextWithEntities" />
    ///</summary>
    public MyTelegram.Schema.ITextWithEntities Text { get; set; }

    ///<summary>
    /// The param that has to be passed to <a href="https://corefork.telegram.org/method/messages.sendVote">messages.sendVote</a>.
    ///</summary>
    public string Option { get; set; }

    public void ComputeFlag()
    {

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Text = buffer.Read<MyTelegram.Schema.ITextWithEntities>();
        Option = buffer.ReadString();
    }
}