using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.Model
{
    public class VariableMonitor : NotifyBase
    {
        public int Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
        private int _mId;


        public string VarName { get { return _mVarName; } set { _mVarName = value; OnPropertyChanged(); } }
        private string _mVarName;


        public string PLCAddress { get { return _mPLCAddress; } set { _mPLCAddress = value; OnPropertyChanged(); } }
        private string _mPLCAddress;


        public string Notes { get { return _mNotes; } set { _mNotes = value; OnPropertyChanged(); } }
        private string _mNotes;


        public string ModbusTcpAddress { get { return _mModbusTcpAddress; } set { _mModbusTcpAddress = value; OnPropertyChanged(); } }
        private string _mModbusTcpAddress;


        public string CurrentValue
        {
            get { return _mCurrentValue; }
            set
            {
                _mCurrentValue = value;
                OnPropertyChanged();
                if (_mCurrentValue == "False" || _mCurrentValue == "True")
                {
                    if (_mCurrentValue == "True")
                        StatusColor = new { r = 51, g = 232, b = 34, a = 1 };
                    else
                        StatusColor = new { r = 255, g = 0, b = 0, a = 1 };
                }
                else
                    StatusColor = new { r = 51, g = 232, b = 34, a = 1 };
            }
        }
        private string _mCurrentValue;
        public bool SwitchValue
        {
            get { return _sWitchValue; }
            set
            {
                _sWitchValue = value;
                OnPropertyChanged();
            }
        }
        private bool _sWitchValue;
        public int IntValue
        {
            get { return _intValue; }
            set
            {
                _intValue = value;
                OnPropertyChanged();
            }
        }
        private int _intValue;
        public object StatusColor { get; set; }
    }
}
