namespace decePubClient.Models.Mastodon;
/// A hashtag as PrivaPub describes it: its last week of use in public posts it holds, and whether the persona
/// follows it (null when nobody is signed in).
public class Tag
{
public string Name { get; set; }
public string Url { get; set; }
public List History { get; set; } = [];
public bool? Following { get; set; }
public int WeekUses => History.Sum(h => h.UsesCount);
public int TodayAccounts => History.FirstOrDefault()?.AccountsCount ?? 0;
}
/// One day of a tag's or a link's use; Mastodon sends the numbers as strings, the day as unix time.
public class TagDay
{
public string Day { get; set; }
public string Uses { get; set; }
public string Accounts { get; set; }
public int UsesCount => int.TryParse(Uses, out var n) ? n : 0;
public int AccountsCount => int.TryParse(Accounts, out var n) ? n : 0;
}
/// A link many authors shared this week: its preview card with its days.
public class TrendLink : PreviewCard
{
public List History { get; set; } = [];
public int WeekAccounts => History.Sum(h => h.AccountsCount);
}