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

namespace MyTelegram.Schema.Payments;

///<summary>
/// Obtain info about <a href="https://corefork.telegram.org/api/stars#balance-and-transaction-history">Telegram Star transactions »</a> using specific transaction IDs.
/// <para>Possible errors</para>
/// Code Type Description
/// 400 PEER_ID_INVALID The provided peer id is invalid.
/// See <a href="https://corefork.telegram.org/method/payments.getStarsTransactionsByID" />
///</summary>
[TlObject(0x2dca16b8)]
public sealed class RequestGetStarsTransactionsByID : IRequest<MyTelegram.Schema.Payments.IStarsStatus>
{
    public uint ConstructorId => 0x2dca16b8;
    public int Flags { get; set; }
    public bool Ton { get; set; }

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

    ///<summary>
    /// Transaction IDs.
    ///</summary>
    public TVector<MyTelegram.Schema.IInputStarsTransaction> Id { get; set; }

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

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Flags = buffer.ReadInt32();
        if (Flags.IsBitSet(0)) { Ton = true; }
        Peer = buffer.Read<MyTelegram.Schema.IInputPeer>();
        Id = buffer.Read<TVector<MyTelegram.Schema.IInputStarsTransaction>>();
    }
}
