using ScadaLink.Commons.Entities.Audit; using ScadaLink.Commons.Types; using ScadaLink.Commons.Types.Audit; namespace ScadaLink.CentralUI.Services; /// /// CentralUI facade over /// (#23 M7-T3). The Audit Log page's results grid talks to this service rather than /// the repository directly so tests can substitute a fake without spinning up EF /// Core, and so a future caching / shaping layer (e.g. server-side CSV streaming) /// can hang off the same seam. /// public interface IAuditLogQueryService { /// /// Returns a keyset-paged result page for . When /// is null, defaults to /// rows with no cursor (first page). The repository orders by /// (OccurredAtUtc DESC, EventId DESC); pass the last row's /// + /// back as the cursor for the next page. /// Task> QueryAsync( AuditLogQueryFilter filter, AuditLogPaging? paging = null, CancellationToken ct = default); /// Default page size when callers don't specify one. int DefaultPageSize { get; } /// /// Audit Log (#23) M7 Bundle E (T13) — returns the point-in-time KPI snapshot /// the Health dashboard's Audit tiles render. Composes: /// /// TotalEventsLastHour + ErrorEventsLastHour from /// /// (1-hour trailing window). /// BacklogTotal from the sum of every site's /// SiteHealthReport.SiteAuditBacklog.PendingCount via /// . /// /// /// /// Repository + aggregator are read independently; if either source has no /// data the corresponding field is zero (a real signal — "no events" vs /// "no backlog" — rather than an error). The service does NOT swallow /// exceptions; the page wraps the call in a try/catch so a transient DB /// outage degrades the tile group to "unavailable" rather than killing the /// dashboard. /// Task GetKpiSnapshotAsync(CancellationToken ct = default); }