using System;
using System.Collections.Generic;

namespace ZB.MOM.WW.OtOpcUa.Driver.Historian.Wonderware.Backend
{
    /// <summary>
    ///     Point-in-time runtime health of the historian subsystem — consumed by the status dashboard
    ///     via an IPC health query (not wired in PR #5; deferred).
    /// </summary>
    public sealed class HistorianHealthSnapshot
    {
        /// <summary>Gets or sets the total number of queries executed.</summary>
        public long TotalQueries { get; set; }
        /// <summary>Gets or sets the total number of successful queries.</summary>
        public long TotalSuccesses { get; set; }
        /// <summary>Gets or sets the total number of failed queries.</summary>
        public long TotalFailures { get; set; }
        /// <summary>Gets or sets the number of consecutive failures.</summary>
        public int ConsecutiveFailures { get; set; }
        /// <summary>Gets or sets the time of the last successful query.</summary>
        public DateTime? LastSuccessTime { get; set; }
        /// <summary>Gets or sets the time of the last failed query.</summary>
        public DateTime? LastFailureTime { get; set; }
        /// <summary>Gets or sets the last error message, if any.</summary>
        public string? LastError { get; set; }
        /// <summary>Gets or sets a value indicating whether the process connection is open.</summary>
        public bool ProcessConnectionOpen { get; set; }
        /// <summary>Gets or sets a value indicating whether the event connection is open.</summary>
        public bool EventConnectionOpen { get; set; }
        /// <summary>Gets or sets the name of the active process node.</summary>
        public string? ActiveProcessNode { get; set; }
        /// <summary>Gets or sets the name of the active event node.</summary>
        public string? ActiveEventNode { get; set; }
        /// <summary>Gets or sets the total number of cluster nodes.</summary>
        public int NodeCount { get; set; }
        /// <summary>Gets or sets the number of healthy cluster nodes.</summary>
        public int HealthyNodeCount { get; set; }
        /// <summary>Gets or sets the list of cluster node states.</summary>
        public List<HistorianClusterNodeState> Nodes { get; set; } = new();
    }
}
