using ScadaLink.Commons.Messages.Health;

namespace ScadaLink.HealthMonitoring;

/// <summary>
/// Interface for central-side health aggregation.
/// Consumed by Central UI to display site health dashboards.
/// </summary>
public interface ICentralHealthAggregator
{
    void ProcessReport(SiteHealthReport report);

    /// <summary>
    /// Bumps the last-seen timestamp for a site already known via a prior
    /// SiteHealthReport. Used to keep a site marked online between full
    /// 30s reports when ~2s heartbeats are arriving — protects against the
    /// 60s offline threshold firing on a transiently delayed report.
    /// </summary>
    void MarkHeartbeat(string siteId, DateTimeOffset receivedAt);

    IReadOnlyDictionary<string, SiteHealthState> GetAllSiteStates();
    SiteHealthState? GetSiteState(string siteId);
}
