using System;
using System.Collections.Generic;

namespace HRD.WebApi.DAL
{
    public class ServerInfo : BaseEntity
    {
#pragma warning disable CS1030 // #warning: 'evtl. im InfoController per DI holen'
#warning evtl. im InfoController per DI holen
        public string Version { get; set; }
#pragma warning restore CS1030 // #warning: 'evtl. im InfoController per DI holen'
        public bool IsLive { get; set; }
        public string Server { get; set; }
        public int Status { get; set; }
        public string Message { get; set; }

        public string DatabaseServer { get; set; }
        public string DatabaseName { get; set; }
        public string DatabaseStatus { get; set; }
        public string ClientVersion { get; set; }
        public DateTime? FirstOnlineTime { get; set; }
        public DateTime? LastOfflineTime { get; set; }
        public Dictionary<string, string> Attributes { get; set; }

        public string GetInfo(string clientRepresentation)
        {
            if (this.LastOfflineTime != default)
            {
                return $"InfoController ({clientRepresentation}): First online time: {FirstOnlineTime} Last offline time: {this.LastOfflineTime}";
            }
            else
            {
                return $"InfoController ({clientRepresentation}): First online time: {FirstOnlineTime}";
            }
        }
    }
}