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

namespace MyTelegram.Schema.Payments;

///<summary>
/// Available <a href="https://corefork.telegram.org/api/gifts">gifts »</a>.
/// See <a href="https://corefork.telegram.org/constructor/payments.starGifts" />
///</summary>
[TlObject(0x901689ea)]
public sealed class TStarGifts : IStarGifts
{
    public uint ConstructorId => 0x901689ea;
    ///<summary>
    /// <a href="https://corefork.telegram.org/api/offsets#hash-generation">Hash used for caching, for more info click here</a>
    ///</summary>
    public int Hash { get; set; }

    ///<summary>
    /// List of available gifts.
    ///</summary>
    public TVector<MyTelegram.Schema.IStarGift> Gifts { get; set; } = new();

    ///<summary>
    /// Chats mentioned in gifts (e.g. released_by)
    ///</summary>
    public TVector<MyTelegram.Schema.IChat> Chats { get; set; } = new();

    ///<summary>
    /// Users mentioned in gifts (e.g. released_by)
    ///</summary>
    public TVector<MyTelegram.Schema.IUser> Users { get; set; } = new();

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Hash);
        writer.Write(Gifts);
        writer.Write(Chats);
        writer.Write(Users);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Hash = buffer.ReadInt32();
        Gifts = buffer.Read<TVector<MyTelegram.Schema.IStarGift>>();
        Chats = buffer.Read<TVector<MyTelegram.Schema.IChat>>();
        Users = buffer.Read<TVector<MyTelegram.Schema.IUser>>();
    }
}