using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Prism.Mvvm;

namespace CyberX8_MainPages.Unity
{
    //public class SystemConfig
    //{
    public enum DataType
    {
        Unknown,
        Int,
        Enum,
        Double,
        Bool,
        String
    };

    public class ConfigNode :BindableBase
        {
            private string name = string.Empty;
            public string Name
            {
                get { return name; }
                set { name = value; RaisePropertyChanged("Name"); }
            }

            private string path = string.Empty;
            public string Path
            {
                get { return path; }
                set { path = value; RaisePropertyChanged("Path"); }
            }

            private bool isshow = true;
            public bool IsShow
            {
                get { return isshow; }
                set { isshow = value; RaisePropertyChanged("IsShow"); }
            }

            private List<ConfigNode> _subNodes = null;
            public List<ConfigNode> SubNodes
            {
                get { return _subNodes; }
                set { _subNodes = value; RaisePropertyChanged("SubNodes"); }
            }

            private List<ConfigItem> _items = null;
            public List<ConfigItem> Items
            {
                get { return _items; }
                set { _items = value; RaisePropertyChanged("Items"); }
            }

        }

        public class ConfigItem : BindableBase
        {
            private string name = string.Empty;
            public string Name
            {
                get { return name; }
                set { name = value; RaisePropertyChanged("Name"); }
            }

            private string description = string.Empty;
            public string Description
            {
                get { return description; }
                set { description = value; RaisePropertyChanged("Description"); }
            }

            private DataType type = DataType.Unknown;
            public DataType Type
            {
                get { return type; }
                set { type = value; RaisePropertyChanged("Type"); }
            }

            private string defaultValue = string.Empty;
            public string DefaultValue
            {
                get { return defaultValue; }
                set { defaultValue = value; RaisePropertyChanged("DefaultValue"); }
            }

            private double max = double.NaN;
            public double Max
            {
                get { return max; }
                set { max = value; RaisePropertyChanged("Max"); }
            }

            private double min = double.NaN;
            public double Min
            {
                get { return min; }
                set { min = value; RaisePropertyChanged("Min"); }
            }

            private string parameter = string.Empty;
            public string Parameter
            {
                get { return parameter; }
                set { parameter = value; RaisePropertyChanged("Parameter"); }
            }

            private string tag = string.Empty;
            public string Tag
            {
                get { return tag; }
                set { tag = value; RaisePropertyChanged("Tag"); }
            }

            private string unit = string.Empty;
            public string Unit
            {
                get { return unit; }
                set { unit = value; RaisePropertyChanged("Unit"); }
            }

            private bool visible = true;
            public bool Visible
            {
                get { return visible; }
                set { visible = value; RaisePropertyChanged("Visible"); }
            }

            /// <summary>
            /// current value from interface, ready only
            /// </summary>
            private string cvalue = string.Empty;
            public string CurrentValue
            {
                get { return cvalue; }
                set { cvalue = value; RaisePropertyChanged("CurrentValue"); }
            }

            #region setpoint value
            private bool _bvalue = false;
            public bool BoolValue
            {
                get { return _bvalue; }
                set { _bvalue = value; RaisePropertyChanged("BoolValue"); }
            }

            private string _sValue = string.Empty;
            public string StringValue
            {
                get { return _sValue; }
                set { _sValue = value; RaisePropertyChanged("StringValue"); }
            }

            private bool _textSaved = true;
            public bool TextSaved
            {
                get { return _textSaved; }
                set { _textSaved = value; RaisePropertyChanged("TextSaved"); }
            }
            #endregion
        }
    //}
}