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

namespace MyTelegram.Schema.Stats;

///<summary>
/// Supergroup <a href="https://corefork.telegram.org/api/stats">statistics</a>
/// See <a href="https://corefork.telegram.org/constructor/stats.megagroupStats" />
///</summary>
[TlObject(0xef7ff916)]
public sealed class TMegagroupStats : IMegagroupStats
{
    public uint ConstructorId => 0xef7ff916;
    ///<summary>
    /// Period in consideration
    /// See <a href="https://corefork.telegram.org/type/StatsDateRangeDays" />
    ///</summary>
    public MyTelegram.Schema.IStatsDateRangeDays Period { get; set; }

    ///<summary>
    /// Member count change for period in consideration
    /// See <a href="https://corefork.telegram.org/type/StatsAbsValueAndPrev" />
    ///</summary>
    public MyTelegram.Schema.IStatsAbsValueAndPrev Members { get; set; }

    ///<summary>
    /// Message number change for period in consideration
    /// See <a href="https://corefork.telegram.org/type/StatsAbsValueAndPrev" />
    ///</summary>
    public MyTelegram.Schema.IStatsAbsValueAndPrev Messages { get; set; }

    ///<summary>
    /// Number of users that viewed messages, for range in consideration
    /// See <a href="https://corefork.telegram.org/type/StatsAbsValueAndPrev" />
    ///</summary>
    public MyTelegram.Schema.IStatsAbsValueAndPrev Viewers { get; set; }

    ///<summary>
    /// Number of users that posted messages, for range in consideration
    /// See <a href="https://corefork.telegram.org/type/StatsAbsValueAndPrev" />
    ///</summary>
    public MyTelegram.Schema.IStatsAbsValueAndPrev Posters { get; set; }

    ///<summary>
    /// Supergroup growth graph (absolute subscriber count)
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph GrowthGraph { get; set; }

    ///<summary>
    /// Members growth (relative subscriber count)
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph MembersGraph { get; set; }

    ///<summary>
    /// New members by source graph
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph NewMembersBySourceGraph { get; set; }

    ///<summary>
    /// Subscriber language graph (pie chart)
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph LanguagesGraph { get; set; }

    ///<summary>
    /// Message activity graph (stacked bar graph, message type)
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph MessagesGraph { get; set; }

    ///<summary>
    /// Group activity graph (deleted, modified messages, blocked users)
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph ActionsGraph { get; set; }

    ///<summary>
    /// Activity per hour graph (absolute)
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph TopHoursGraph { get; set; }

    ///<summary>
    /// Activity per day of week graph (absolute)
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph WeekdaysGraph { get; set; }

    ///<summary>
    /// Info about most active group members
    ///</summary>
    public TVector<MyTelegram.Schema.IStatsGroupTopPoster> TopPosters { get; set; }

    ///<summary>
    /// Info about most active group admins
    ///</summary>
    public TVector<MyTelegram.Schema.IStatsGroupTopAdmin> TopAdmins { get; set; }

    ///<summary>
    /// Info about most active group inviters
    ///</summary>
    public TVector<MyTelegram.Schema.IStatsGroupTopInviter> TopInviters { get; set; }

    ///<summary>
    /// Info about users mentioned in statistics
    ///</summary>
    public TVector<MyTelegram.Schema.IUser> Users { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Period);
        writer.Write(Members);
        writer.Write(Messages);
        writer.Write(Viewers);
        writer.Write(Posters);
        writer.Write(GrowthGraph);
        writer.Write(MembersGraph);
        writer.Write(NewMembersBySourceGraph);
        writer.Write(LanguagesGraph);
        writer.Write(MessagesGraph);
        writer.Write(ActionsGraph);
        writer.Write(TopHoursGraph);
        writer.Write(WeekdaysGraph);
        writer.Write(TopPosters);
        writer.Write(TopAdmins);
        writer.Write(TopInviters);
        writer.Write(Users);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Period = buffer.Read<MyTelegram.Schema.IStatsDateRangeDays>();
        Members = buffer.Read<MyTelegram.Schema.IStatsAbsValueAndPrev>();
        Messages = buffer.Read<MyTelegram.Schema.IStatsAbsValueAndPrev>();
        Viewers = buffer.Read<MyTelegram.Schema.IStatsAbsValueAndPrev>();
        Posters = buffer.Read<MyTelegram.Schema.IStatsAbsValueAndPrev>();
        GrowthGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        MembersGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        NewMembersBySourceGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        LanguagesGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        MessagesGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        ActionsGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        TopHoursGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        WeekdaysGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        TopPosters = buffer.Read<TVector<MyTelegram.Schema.IStatsGroupTopPoster>>();
        TopAdmins = buffer.Read<TVector<MyTelegram.Schema.IStatsGroupTopAdmin>>();
        TopInviters = buffer.Read<TVector<MyTelegram.Schema.IStatsGroupTopInviter>>();
        Users = buffer.Read<TVector<MyTelegram.Schema.IUser>>();
    }
}