using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NEIntelligentControl2.Models.Alarm
{
    /// <summary>
    /// 报警信息
    /// </summary>
    public class AlarmInfo
    {
        public long Id { get; set; }
        public DateTime? AlertTime { get; set; }
        public int MessageType { get; set; }
        public long SnapId { get; set; }
        public string StationId { get; set; }
        public string ProjectId { get; set; }
        public string LineId { get; set; }
        public string WindturbineId { get; set; }
        public int AlertValue { get; set; }
        public string Category1 { get; set; }
        public string Category2 { get; set; }
        public string Category3 { get; set; }
        public string Rank { get; set; }
        public string StationName { get; set; }
        public string WindturbineName { get; set; }
        public string AlertText { get; set; }
        public string ModelId { get; set; }
        public int IsOpened { get; set; }
        public DateTime? LastUpdateTime { get; set; }

        public string AlertTimeTimeString { get => AlertTime?.ToString("yyyy-MM-dd HH:mm:ss"); }
        public string LatestUpdateTimeString { get => LastUpdateTime?.ToString("yyyy-MM-dd HH:mm:ss"); }
        private string objectName;
        public string ObjectName
        {
            set => objectName = value;
            get
            {
                if (objectName != null) return objectName;
                if (Category1 == "SYZ" || Category1 == "GF")
                {
                    return StationName;
                }
                return WindturbineName;
            }
        }
        public string RankString
        {
            get
            {
                switch (Rank)
                {
                    case "1":
                        return "低";
                    case "2":
                        return "中低";
                    case "3":
                        return "中";
                    case "4":
                        return "中高";
                    case "5":
                        return "高";
                    default: return "";
                }
            }
        }
        public string Category1String
        {
            get
            {
                switch (Category1)
                {
                    case "custom":
                        return "自定义";
                    case "SYZ":
                        return "升压站";
                    case "windturbine":
                        return "风机";
                    default:return "";
                }
            }
        }

    }
}
