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

namespace MyTelegram.Schema.Payments;

///<summary>
/// See <a href="https://corefork.telegram.org/method/payments.editConnectedStarRefBot" />
///</summary>
[TlObject(0xe4fca4a3)]
public sealed class RequestEditConnectedStarRefBot : IRequest<MyTelegram.Schema.Payments.IConnectedStarRefBots>
{
    public uint ConstructorId => 0xe4fca4a3;
    ///<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>
    /// &nbsp;
    /// See <a href="https://corefork.telegram.org/type/true" />
    ///</summary>
    public bool Revoked { get; set; }

    ///<summary>
    /// &nbsp;
    /// See <a href="https://corefork.telegram.org/type/InputPeer" />
    ///</summary>
    public MyTelegram.Schema.IInputPeer Peer { get; set; }

    ///<summary>
    /// &nbsp;
    ///</summary>
    public string Link { get; set; }

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

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Flags = buffer.ReadInt32();
        if (Flags.IsBitSet(0)) { Revoked = true; }
        Peer = buffer.Read<MyTelegram.Schema.IInputPeer>();
        Link = buffer.ReadString();
    }
}
