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

namespace MyTelegram.Schema.Phone;

///<summary>
/// See <a href="https://corefork.telegram.org/method/phone.deleteConferenceCallParticipants" />
///</summary>
[TlObject(0x8ca60525)]
public sealed class RequestDeleteConferenceCallParticipants : IRequest<MyTelegram.Schema.IUpdates>
{
    public uint ConstructorId => 0x8ca60525;
    public int Flags { get; set; }
    public bool OnlyLeft { get; set; }
    public bool Kick { get; set; }
    public MyTelegram.Schema.IInputGroupCall Call { get; set; }
    public TVector<long> Ids { get; set; }
    public ReadOnlyMemory<byte> Block { get; set; }

    public void ComputeFlag()
    {
        if (OnlyLeft) { Flags = Flags.SetBit(0); }
        if (Kick) { Flags = Flags.SetBit(1); }

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Flags = buffer.ReadInt32();
        if (Flags.IsBitSet(0)) { OnlyLeft = true; }
        if (Flags.IsBitSet(1)) { Kick = true; }
        Call = buffer.Read<MyTelegram.Schema.IInputGroupCall>();
        Ids = buffer.Read<TVector<long>>();
        Block = buffer.ReadBytes();
    }
}
