using Prism.Mvvm;

namespace UIShare.UIViewModel
{
    // 继承 BindableBase 使得属性变更时能实时通知 UI 刷新
    public class ValueLimitVM : BindableBase
    {
        private string _signalName = string.Empty;
        private string _fingerprint = string.Empty;
        private string _methodName = string.Empty;
        private string _displayName = string.Empty;
        private double _upper;
        private double _lower;
        private double _upperExtreme;
        private double _lowerExtreme;
        private bool _isAlarm = false;
        private AlarmStatus _alarmStatus = AlarmStatus.未报警;

        /// <summary>
        /// 信号名（显示用）
        /// </summary>
        public string SignalName
        {
            get => _signalName;
            set => SetProperty(ref _signalName, value);
        }  
        /// <summary>
        /// 信号名（显示用）
        /// </summary>
        public string DisplayName
        {
            get => _displayName;
            set => SetProperty(ref _displayName, value);
        }

        /// <summary>
        /// 硬件指纹（物理设备唯一标识，用于超限匹配）
        /// </summary>
        public string Fingerprint
        {
            get => _fingerprint;
            set => SetProperty(ref _fingerprint, value);
        }

        /// <summary>
        /// 方法名（唯一标识，用于超限匹配）
        /// </summary>
        public string MethodName
        {
            get => _methodName;
            set => SetProperty(ref _methodName, value);
        }

        /// <summary>
        /// 上限
        /// </summary>
        public double Upper
        {
            get => _upper;
            set => SetProperty(ref _upper, value);
        }

        /// <summary>
        /// 下限
        /// </summary>
        public double Lower
        {
            get => _lower;
            set => SetProperty(ref _lower, value);
        }

        /// <summary>
        /// 上极限
        /// </summary>
        public double UpperExtreme
        {
            get => _upperExtreme;
            set => SetProperty(ref _upperExtreme, value);
        }

        /// <summary>
        /// 下极限
        /// </summary>
        public double LowerExtreme
        {
            get => _lowerExtreme;
            set => SetProperty(ref _lowerExtreme, value);
        }

        /// <summary>
        /// 是否报警
        /// </summary>
        public bool IsAlarm
        {
            get => _isAlarm;
            set => SetProperty(ref _isAlarm, value);
        }

        /// <summary>
        /// 警报状态类型
        /// </summary>
        public AlarmStatus AlarmSatus
        {
            get => _alarmStatus;
            set => SetProperty(ref _alarmStatus, value);
        }
    }

    public enum AlarmStatus
    {
        未报警 = 0,         // 未报警
        超上限 = 1,         // 超上限
        超下限 = 2,         // 超下限
        超上极限 = 3,       // 超上极限
        超下极限 = 4,       // 超下极限
    }
}