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

namespace MyTelegram.Schema.Payments;

///<summary>
/// Make a payment using <a href="https://corefork.telegram.org/api/stars#using-stars">Telegram Stars, see here »</a> for more info.
/// <para>Possible errors</para>
/// Code Type Description
/// 400 BALANCE_TOO_LOW The transaction cannot be completed because the current <a href="https://corefork.telegram.org/api/stars">Telegram Stars balance</a> is too low.
/// 400 FORM_EXPIRED The form was generated more than 10 minutes ago and has expired, please re-generate it using <a href="https://corefork.telegram.org/method/payments.getPaymentForm">payments.getPaymentForm</a> and pass the new <code>form_id</code>.
/// 400 PEER_ID_INVALID The provided peer id is invalid.
/// See <a href="https://corefork.telegram.org/method/payments.sendStarsForm" />
///</summary>
[TlObject(0x7998c914)]
public sealed class RequestSendStarsForm : IRequest<MyTelegram.Schema.Payments.IPaymentResult>
{
    public uint ConstructorId => 0x7998c914;
    ///<summary>
    /// Payment form ID
    ///</summary>
    public long FormId { get; set; }

    ///<summary>
    /// Invoice
    /// See <a href="https://corefork.telegram.org/type/InputInvoice" />
    ///</summary>
    public MyTelegram.Schema.IInputInvoice Invoice { get; set; }

    public void ComputeFlag()
    {

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        FormId = buffer.ReadInt64();
        Invoice = buffer.Read<MyTelegram.Schema.IInputInvoice>();
    }
}
