using System;
using System.Collections.Generic;

namespace ZB.MOM.WW.LmxProxy.Host.Status
{
    public class StatusData
    {
        public DateTime Timestamp { get; set; }
        public string ServiceName { get; set; } = "";
        public string Version { get; set; } = "";
        public ConnectionStatus Connection { get; set; } = new ConnectionStatus();
        public SubscriptionStatus Subscriptions { get; set; } = new SubscriptionStatus();
        public PerformanceStatus Performance { get; set; } = new PerformanceStatus();
        public HealthInfo Health { get; set; } = new HealthInfo();
    }

    public class ConnectionStatus
    {
        public bool IsConnected { get; set; }
        public string State { get; set; } = "";
        public string NodeName { get; set; } = "";
        public string GalaxyName { get; set; } = "";
        public DateTime? ConnectedSince { get; set; }
        public int ReconnectCount { get; set; }
    }

    public class SubscriptionStatus
    {
        public int TotalClients { get; set; }
        public int TotalTags { get; set; }
        public int ActiveSubscriptions { get; set; }
        public long TotalDelivered { get; set; }
        public long TotalDropped { get; set; }
    }

    public class PerformanceStatus
    {
        public long TotalOperations { get; set; }
        public double AverageSuccessRate { get; set; }
        public Dictionary<string, OperationStatus> Operations { get; set; }
            = new Dictionary<string, OperationStatus>();
    }

    public class OperationStatus
    {
        public long TotalCount { get; set; }
        public double SuccessRate { get; set; }
        public double AverageMilliseconds { get; set; }
        public double MinMilliseconds { get; set; }
        public double MaxMilliseconds { get; set; }
        public double Percentile95Milliseconds { get; set; }
    }

    public class HealthInfo
    {
        public string Status { get; set; } = "";
        public string Description { get; set; } = "";
        public Dictionary<string, string> Data { get; set; } = new Dictionary<string, string>();
    }
}
