using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HBLConsole.Model
{
    [Table(nameof(AlarmSet))]
    public class AlarmSet
    {
        public AlarmSet()
        {
            AnalogAlarmModels.Clear();
            foreach (var item in Enum.GetNames(typeof(EAnalogAlarmType)))
            {
                AnalogAlarmModels.Add(new AnalogAlarmModel()
                {
                    AlarmTag = item,
                    SortTag = (EAnalogAlarmType)Enum.Parse(typeof(EAnalogAlarmType), item)
                });
            }
        }

        [Key]
        public int Id { get; set; }

        /// <summary>
        /// 模拟量报警信息
        /// </summary>
        public ObservableCollection<AnalogAlarmModel> AnalogAlarmModels { get; set; } = new ObservableCollection<AnalogAlarmModel>();

        /// <summary>
        /// 离散量报警信息
        /// </summary>
        public DiscreteAlarmInfo DiscreteAlarmInfoSet { get; set; } = new DiscreteAlarmInfo();

        /// <summary>
        /// 设置外键
        /// </summary>
        [ForeignKey("VariableInfoId")]
        public int VariableInfoId { get; set; }

        /// <summary>
        /// 设置导航属性
        /// </summary>
        public VariableInfo VariableInfo { get; set; }
    }
}
