namespace PrivaPub.ClientModels.Admin { // /clientapi/admin/statistics/overview: the last days' federation at a glance; counters keyed as the ledger keys them public class ViewStatisticsOverview { public int Days { get; set; } public Dictionary Channels { get; set; } = new(); public Dictionary Inbound { get; set; } = new(); public Dictionary Outbound { get; set; } = new(); public double? DeliverySuccess { get; set; } public ViewLatency DeliveryLatencyMs { get; set; } = new(); public ViewHostCounts Hosts { get; set; } = new(); public int Accounts { get; set; } public ViewLedgerCounts Ledger { get; set; } = new(); public ViewMediaTotals Media { get; set; } = new(); } // what media take on the server: the uploads and pictures kept, the remote media cache, the trash waiting its grace public class ViewMediaTotals { public long MediaBytes { get; set; } public long MediaFiles { get; set; } public long ProxyCacheBytes { get; set; } public long TrashBytes { get; set; } } public class ViewLatency { public int? P50 { get; set; } public int? P95 { get; set; } } public class ViewHostCounts { public int Active { get; set; } public long Known { get; set; } } public class ViewLedgerCounts { public long Written { get; set; } public long Dropped { get; set; } public long Failed { get; set; } } // /clientapi/admin/statistics/hosts: one page of the servers we exchanged with public class ViewHostsPage { public int Total { get; set; } public int Page { get; set; } public List Hosts { get; set; } = new(); public string Attribution { get; set; } } public class ViewHostRow { public string Host { get; set; } public string Software { get; set; } public string Version { get; set; } public long In { get; set; } public long Out { get; set; } public long Refused { get; set; } public long Failures { get; set; } public int? LatencyP50 { get; set; } public int Accounts { get; set; } public DateTime? DescribedAt { get; set; } public ViewHostDelivery Delivery { get; set; } } public class ViewHostDelivery { public int ConsecutiveFailures { get; set; } public DateTime? UnavailableUntil { get; set; } public DateTime? LastSuccessAt { get; set; } public DateTime? LastFailureAt { get; set; } } // /clientapi/admin/statistics/crawler: how far the crawler got public class ViewCrawler { public bool Enabled { get; set; } public long Touched { get; set; } public long Crawled { get; set; } public long Due { get; set; } public long RobotsDisallowed { get; set; } public List Recent { get; set; } = new(); } public class ViewCrawledHost { public string Host { get; set; } public string Seen { get; set; } public DateTime? LastCrawledAt { get; set; } public int? PeersCount { get; set; } public bool? RobotsDisallowed { get; set; } public string CrawlError { get; set; } public string Software { get; set; } } // /clientapi/admin/statistics/hosts/{host}: one server, what it says of itself, its days and its latest events public class ViewHostDetail { public string Host { get; set; } public ViewHostInstance Instance { get; set; } public List Days { get; set; } = []; public List Events { get; set; } = []; public string Attribution { get; set; } } public class ViewHostInstance { public string Software { get; set; } public string SoftwareVersion { get; set; } public string NodeName { get; set; } public string Title { get; set; } public string NodeDescription { get; set; } public bool? OpenRegistrations { get; set; } public string RegistrationMode { get; set; } public long? UsersTotal { get; set; } public long? UsersActiveMonth { get; set; } public long? LocalPosts { get; set; } public List Languages { get; set; } = []; public string Seen { get; set; } public DateTime? FirstSeenAt { get; set; } public DateTime? LastSeenAt { get; set; } public DateTime? DescribedAt { get; set; } public string DescriptionError { get; set; } public DateTime? LastSuccessAt { get; set; } public DateTime? LastFailureAt { get; set; } public string LastError { get; set; } public int ConsecutiveFailures { get; set; } public DateTime? UnavailableUntil { get; set; } public string Country { get; set; } public string City { get; set; } public int? Asn { get; set; } public string AsnOrg { get; set; } public string Cdn { get; set; } public string InstanceApi { get; set; } public string SourceUrl { get; set; } } public class ViewHostDay { public DateTime Day { get; set; } public Dictionary Counters { get; set; } = new(); public Dictionary Latency { get; set; } = new(); public Dictionary Bytes { get; set; } = new(); public Dictionary Reads { get; set; } = new(); public int Accounts { get; set; } public bool Live { get; set; }//today's or a day not rolled up yet, folded from its events } // one ledger entry: what was received, delivered or fetched, and how it ended; never who public class ViewInteractionEvent { public DateTime At { get; set; } public string Host { get; set; } public string Channel { get; set; } public string Activity { get; set; } public string Object { get; set; } public string Purpose { get; set; } public string Trigger { get; set; } public string Outcome { get; set; } public string Reason { get; set; } public int? Status { get; set; } public int? LatencyMs { get; set; } public int? WaitMs { get; set; } public long? Bytes { get; set; } public int? Attempt { get; set; } public string Audience { get; set; } public string LocalKind { get; set; } public string Inbox { get; set; } public string Signature { get; set; } public List Features { get; set; } = []; public long? AgeSeconds { get; set; } } // /clientapi/admin/statistics/server: the server's own day, its client API and the documents it served public class ViewServerDay { public DateTime Day { get; set; } public Dictionary Client { get; set; } = new(); public Dictionary ClientLatency { get; set; } = new(); public Dictionary Served { get; set; } = new(); public long LedgerWritten { get; set; } public long LedgerDropped { get; set; } public long LedgerFailed { get; set; } public int Accounts { get; set; } public int Hosts { get; set; } } }