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

namespace MyTelegram.Schema;

///<summary>
/// New WebRTC parameters
/// See <a href="https://corefork.telegram.org/constructor/updateGroupCallConnection" />
///</summary>
[TlObject(0xb783982)]
public sealed class TUpdateGroupCallConnection : IUpdate
{
    public uint ConstructorId => 0xb783982;
    ///<summary>
    /// Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a>
    ///</summary>
    public int Flags { get; set; }

    ///<summary>
    /// Are these parameters related to the screen capture session currently in progress?
    /// See <a href="https://corefork.telegram.org/type/true" />
    ///</summary>
    public bool Presentation { get; set; }

    ///<summary>
    /// WebRTC parameters
    /// See <a href="https://corefork.telegram.org/type/DataJSON" />
    ///</summary>
    public MyTelegram.Schema.IDataJSON Params { get; set; }

    public void ComputeFlag()
    {
        if (Presentation) { Flags = Flags.SetBit(0); }

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Flags = buffer.ReadInt32();
        if (Flags.IsBitSet(0)) { Presentation = true; }
        Params = buffer.Read<MyTelegram.Schema.IDataJSON>();
    }
}