namespace AxCopilot.Models; /// /// Period filter for the Code tab usage dashboard. /// Mirrors the "All / 30d / 7d" controls shown in the reference stats view. /// public enum CodeStatsPeriod { /// Aggregate over every record on disk. All = 0, /// Aggregate over the last 30 days. Last30Days = 30, /// Aggregate over the last 7 days. Last7Days = 7, } /// /// One day in the activity heatmap. /// IntensityLevel is 0..4 where 0 means "no activity". /// public sealed record CodeStatsHeatmapCell(DateTime Date, long Tokens, int IntensityLevel); /// One model bucket within a single day of the model chart. public sealed record CodeStatsModelDailyTokens(string Model, long Tokens); /// One day in the stacked model chart. public sealed record CodeStatsDailyModelStack(DateTime Date, IReadOnlyList Models); /// /// Per-model aggregate row shown beneath the model stacked bar chart. /// SharePercent is 0..100. /// public sealed record CodeStatsModelTotal( string Model, long InTokens, long OutTokens, double SharePercent); /// /// Summary model used by the Code tab usage dashboard. /// public sealed record CodeStatsSummary { public int SessionsCount { get; init; } public int MessagesCount { get; init; } public long TotalTokens { get; init; } public int ActiveDays { get; init; } public int CurrentStreak { get; init; } public int LongestStreak { get; init; } public int? MostActiveHour { get; init; } public string? FavoriteModel { get; init; } public IReadOnlyList Heatmap { get; init; } = Array.Empty(); public IReadOnlyList ModelStack { get; init; } = Array.Empty(); public IReadOnlyList ModelTotals { get; init; } = Array.Empty(); public CodeStatsPeriod Period { get; init; } public DateTime ComputedAtUtc { get; init; } public static CodeStatsSummary Empty(CodeStatsPeriod period) => new() { Period = period, ComputedAtUtc = DateTime.UtcNow, }; }