using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Newtonsoft.Json;
using HBLConsole.Service;

namespace HBLConsole.Model
{
    /// <summary>
    /// 变量信息
    /// </summary>
    [Table(nameof(VariableInfo))]
    public class VariableInfo : ObservableObject
    {

        [Key]
        public int ID { get { return _mID; } set { _mID = value; OnPropertyChanged(); } }
        private int _mID;

        /// <summary>
        /// 变量名
        /// </summary>
        public string VarName
        {
            get { return _mVarName; }
            set
            {
                _mVarName = value;
                OnPropertyChanged();
                ActionOperate.GetInstance.Send("VarNameChanged", _mID);
            }
        }
        private string _mVarName;

        /// <summary>
        /// 地址
        /// </summary>
        public string Address { get { return _mAddress; } set { _mAddress = value; OnPropertyChanged(); } }
        private string _mAddress;

        /// <summary>
        /// 数据类型
        /// </summary>
        public string DataType { get { return _mDataType; } set { _mDataType = value; OnPropertyChanged(); } }
        private string _mDataType;

        /// <summary>
        /// 是否启用报警
        /// </summary>
        public bool IsEnableAlarm { get { return _mIsEnableAlarm; } set { _mIsEnableAlarm = value; OnPropertyChanged(); } }
        private bool _mIsEnableAlarm;

        /// <summary>
        /// 当前值
        /// </summary>
        public string CurrentValue { get { return _mCurrentValue; } set { _mCurrentValue = value; OnPropertyChanged(); } }
        private string _mCurrentValue;

        /// <summary>
        /// 报警设置信息
        /// </summary>
        public AlarmSet AlarmSetProp { get { return _mAlarmSetProp; } set { _mAlarmSetProp = value; OnPropertyChanged(); } }
        private AlarmSet _mAlarmSetProp = new AlarmSet();


    }
}
