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

namespace MyTelegram.Schema.Messages;

///<summary>
/// Delete the entire phone call history.
/// See <a href="https://corefork.telegram.org/method/messages.deletePhoneCallHistory" />
///</summary>
[TlObject(0xf9cbe409)]
public sealed class RequestDeletePhoneCallHistory : IRequest<MyTelegram.Schema.Messages.IAffectedFoundMessages>
{
    public uint ConstructorId => 0xf9cbe409;
    ///<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>
    /// Whether to remove phone call history for participants as well
    /// See <a href="https://corefork.telegram.org/type/true" />
    ///</summary>
    public bool Revoke { get; set; }

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

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

    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Flags = buffer.ReadInt32();
        if (Flags.IsBitSet(0)) { Revoke = true; }
    }
}
