using Prism.Mvvm;  // 引入 Prism 的 BindableBase
using System;
using System.Collections.ObjectModel;
using System.Linq;

namespace UIShare.UIViewModel
{
    public class ProgramVM : BindableBase
    {
        #region 构造函数

        public ProgramVM()
        {
            // 可以进行初始化操作
        }

        public ProgramVM(ProgramVM source)
        {
            ID = source.ID;
            StepCollection = new ObservableCollection<StepVM>(source.StepCollection.Select(p => new StepVM(p)));
            ErrorStepCollection = new ObservableCollection<StepVM>(source.ErrorStepCollection.Select(p => new StepVM(p)));
            Parameters = new ObservableCollection<ParameterVM>(source.Parameters.Select(p => new ParameterVM(p)));
        }

        #endregion

        public Guid ID { get; set; } = Guid.NewGuid();

        private ObservableCollection<StepVM> _stepCollection = new ObservableCollection<StepVM>();
        public ObservableCollection<StepVM> StepCollection
        {
            get => _stepCollection;
            set => SetProperty(ref _stepCollection, value);  
        }
        private ObservableCollection<StepVM> _errorStepCollection = new ObservableCollection<StepVM>();
        public ObservableCollection<StepVM> ErrorStepCollection
        {
            get => _errorStepCollection;
            set => SetProperty(ref _errorStepCollection, value);  
        }

        private ObservableCollection<ParameterVM> _parameters = new ObservableCollection<ParameterVM>();
        public ObservableCollection<ParameterVM> Parameters
        {
            get => _parameters;
            set => SetProperty(ref _parameters, value);
        }

       
    }
}
