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

namespace MyTelegram.Schema;

///<summary>
/// Pricing of a <a href="https://corefork.telegram.org/api/invites#paid-invite-links">Telegram Star subscription »</a>.
/// See <a href="https://corefork.telegram.org/constructor/starsSubscriptionPricing" />
///</summary>
[TlObject(0x5416d58)]
public sealed class TStarsSubscriptionPricing : IStarsSubscriptionPricing
{
    public uint ConstructorId => 0x5416d58;
    ///<summary>
    /// The user should pay <code>amount</code> stars every <code>period</code> seconds to gain and maintain access to the channel. <br>Currently the only allowed subscription period is <code>30*24*60*60</code>, i.e. the user will be debited amount stars every month.
    ///</summary>
    public int Period { get; set; }

    ///<summary>
    /// Price of the subscription in Telegram Stars.
    ///</summary>
    public long Amount { get; set; }

    public void ComputeFlag()
    {

    }

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

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Period = buffer.ReadInt32();
        Amount = buffer.ReadInt64();
    }
}