using Stylet;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MainShell.Recipe.Models.PID
{
    public class PIDProfile : PropertyChangedBase
    {
        private string _name;

        public string Name
        {
            get { return _name; }
            set { SetAndNotify(ref _name, value); }  
        }
        private string _description;
        public string Description
        {
            get { return _description; }
            set { SetAndNotify(ref _description, value); }
        }

        // 每个 profile 下的轴参数集合
        public ObservableCollection<AxisPIDParameter> Axes { get; set; }

        private ObservableCollection<AxisFilteringParameter> _filteringParameters;
        public ObservableCollection<AxisFilteringParameter> FilteringParameters
        {
            get { return _filteringParameters; }
            set { SetAndNotify(ref _filteringParameters, value); }
        }

        public PIDProfile()
        {
            Axes = new ObservableCollection<AxisPIDParameter>();
            FilteringParameters = new ObservableCollection<AxisFilteringParameter>();
        }

        public PIDProfile(string name)
            : this()
        {
            Name = name;
        }

        public void EnsureAxes()
        {
            if (Axes == null)
            {
                Axes = new ObservableCollection<AxisPIDParameter>();
                NotifyOfPropertyChange(() => Axes);
            }

            if (FilteringParameters == null)
            {
                FilteringParameters = new ObservableCollection<AxisFilteringParameter>();
            }
        }
    }
}
