using ScadaLink.Commons.Messages.Health;
namespace ScadaLink.HealthMonitoring;
///
/// In-memory state for a single site's health, stored by the central aggregator.
///
public class SiteHealthState
{
public required string SiteId { get; init; }
public SiteHealthReport LatestReport { get; set; } = null!;
///
/// Time the latest full was processed.
/// Used by the UI to surface report staleness during failover.
///
public DateTimeOffset LastReportReceivedAt { get; set; }
///
/// Time the most recent signal of any kind (full report OR ~5s heartbeat)
/// was received. Drives offline detection — heartbeats from the standby
/// keep the site marked online even when the active node is unable to
/// produce a report (mid-failover, brief stalls).
///
public DateTimeOffset LastHeartbeatAt { get; set; }
public long LastSequenceNumber { get; set; }
public bool IsOnline { get; set; }
}