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

namespace MyTelegram.Schema.Stats;

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

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

    ///<summary>
    /// <code>total_viewcount/postcount</code>, for posts posted during the period in consideration. <br>Note that in this case, <code>current</code> refers to the <code>period</code> in consideration (<code>min_date</code> till <code>max_date</code>), and <code>prev</code> refers to the previous period (<code>(min_date - (max_date - min_date))</code> till <code>min_date</code>).
    /// See <a href="https://corefork.telegram.org/type/StatsAbsValueAndPrev" />
    ///</summary>
    public MyTelegram.Schema.IStatsAbsValueAndPrev ViewsPerPost { get; set; }

    ///<summary>
    /// <code>total_sharecount/postcount</code>, for posts posted during the period in consideration. <br>Note that in this case, <code>current</code> refers to the <code>period</code> in consideration (<code>min_date</code> till <code>max_date</code>), and <code>prev</code> refers to the previous period (<code>(min_date - (max_date - min_date))</code> till <code>min_date</code>)
    /// See <a href="https://corefork.telegram.org/type/StatsAbsValueAndPrev" />
    ///</summary>
    public MyTelegram.Schema.IStatsAbsValueAndPrev SharesPerPost { get; set; }

    ///<summary>
    /// <code>total_reactions/postcount</code>, for posts posted during the period in consideration. <br>Note that in this case, <code>current</code> refers to the <code>period</code> in consideration (<code>min_date</code> till <code>max_date</code>), and <code>prev</code> refers to the previous period (<code>(min_date - (max_date - min_date))</code> till <code>min_date</code>)
    /// See <a href="https://corefork.telegram.org/type/StatsAbsValueAndPrev" />
    ///</summary>
    public MyTelegram.Schema.IStatsAbsValueAndPrev ReactionsPerPost { get; set; }

    ///<summary>
    /// <code>total_views/storycount</code>, for posts posted during the period in consideration. <br>Note that in this case, <code>current</code> refers to the <code>period</code> in consideration (<code>min_date</code> till <code>max_date</code>), and <code>prev</code> refers to the previous period (<code>(min_date - (max_date - min_date))</code> till <code>min_date</code>)
    /// See <a href="https://corefork.telegram.org/type/StatsAbsValueAndPrev" />
    ///</summary>
    public MyTelegram.Schema.IStatsAbsValueAndPrev ViewsPerStory { get; set; }

    ///<summary>
    /// <code>total_shares/storycount</code>, for posts posted during the period in consideration. <br>Note that in this case, <code>current</code> refers to the <code>period</code> in consideration (<code>min_date</code> till <code>max_date</code>), and <code>prev</code> refers to the previous period (<code>(min_date - (max_date - min_date))</code> till <code>min_date</code>)
    /// See <a href="https://corefork.telegram.org/type/StatsAbsValueAndPrev" />
    ///</summary>
    public MyTelegram.Schema.IStatsAbsValueAndPrev SharesPerStory { get; set; }

    ///<summary>
    /// <code>total_reactions/storycount</code>, for posts posted during the period in consideration. <br>Note that in this case, <code>current</code> refers to the <code>period</code> in consideration (<code>min_date</code> till <code>max_date</code>), and <code>prev</code> refers to the previous period (<code>(min_date - (max_date - min_date))</code> till <code>min_date</code>)
    /// See <a href="https://corefork.telegram.org/type/StatsAbsValueAndPrev" />
    ///</summary>
    public MyTelegram.Schema.IStatsAbsValueAndPrev ReactionsPerStory { get; set; }

    ///<summary>
    /// Percentage of subscribers with enabled notifications
    /// See <a href="https://corefork.telegram.org/type/StatsPercentValue" />
    ///</summary>
    public MyTelegram.Schema.IStatsPercentValue EnabledNotifications { get; set; }

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

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

    ///<summary>
    /// Muted users graph (relative)
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph MuteGraph { get; set; }

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

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

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

    ///<summary>
    /// Views by source graph (absolute)
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph ViewsBySourceGraph { get; set; }

    ///<summary>
    /// New followers by source graph (absolute)
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph NewFollowersBySourceGraph { 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>
    /// A graph containing the number of reactions on posts categorized by emotion
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph ReactionsByEmotionGraph { get; set; }

    ///<summary>
    /// A graph containing the number of story views and shares
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph StoryInteractionsGraph { get; set; }

    ///<summary>
    /// A graph containing the number of reactions on stories categorized by emotion
    /// See <a href="https://corefork.telegram.org/type/StatsGraph" />
    ///</summary>
    public MyTelegram.Schema.IStatsGraph StoryReactionsByEmotionGraph { get; set; }

    ///<summary>
    /// Detailed statistics about number of views and shares of recently sent messages and stories
    ///</summary>
    public TVector<MyTelegram.Schema.IPostInteractionCounters> RecentPostsInteractions { get; set; }

    public void ComputeFlag()
    {

    }

    public void Serialize(IBufferWriter<byte> writer)
    {
        ComputeFlag();
        writer.Write(ConstructorId);
        writer.Write(Period);
        writer.Write(Followers);
        writer.Write(ViewsPerPost);
        writer.Write(SharesPerPost);
        writer.Write(ReactionsPerPost);
        writer.Write(ViewsPerStory);
        writer.Write(SharesPerStory);
        writer.Write(ReactionsPerStory);
        writer.Write(EnabledNotifications);
        writer.Write(GrowthGraph);
        writer.Write(FollowersGraph);
        writer.Write(MuteGraph);
        writer.Write(TopHoursGraph);
        writer.Write(InteractionsGraph);
        writer.Write(IvInteractionsGraph);
        writer.Write(ViewsBySourceGraph);
        writer.Write(NewFollowersBySourceGraph);
        writer.Write(LanguagesGraph);
        writer.Write(ReactionsByEmotionGraph);
        writer.Write(StoryInteractionsGraph);
        writer.Write(StoryReactionsByEmotionGraph);
        writer.Write(RecentPostsInteractions);
    }

    public void Deserialize(ref ReadOnlyMemory<byte> buffer)
    {
        Period = buffer.Read<MyTelegram.Schema.IStatsDateRangeDays>();
        Followers = buffer.Read<MyTelegram.Schema.IStatsAbsValueAndPrev>();
        ViewsPerPost = buffer.Read<MyTelegram.Schema.IStatsAbsValueAndPrev>();
        SharesPerPost = buffer.Read<MyTelegram.Schema.IStatsAbsValueAndPrev>();
        ReactionsPerPost = buffer.Read<MyTelegram.Schema.IStatsAbsValueAndPrev>();
        ViewsPerStory = buffer.Read<MyTelegram.Schema.IStatsAbsValueAndPrev>();
        SharesPerStory = buffer.Read<MyTelegram.Schema.IStatsAbsValueAndPrev>();
        ReactionsPerStory = buffer.Read<MyTelegram.Schema.IStatsAbsValueAndPrev>();
        EnabledNotifications = buffer.Read<MyTelegram.Schema.IStatsPercentValue>();
        GrowthGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        FollowersGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        MuteGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        TopHoursGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        InteractionsGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        IvInteractionsGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        ViewsBySourceGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        NewFollowersBySourceGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        LanguagesGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        ReactionsByEmotionGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        StoryInteractionsGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        StoryReactionsByEmotionGraph = buffer.Read<MyTelegram.Schema.IStatsGraph>();
        RecentPostsInteractions = buffer.Read<TVector<MyTelegram.Schema.IPostInteractionCounters>>();
    }
}