using MainShell.Models;
using MainShell.ParaSetting.Model;
using MaxwellFramework.Core.Interfaces;
using MwFramework.ManagerService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MainShell.ParaSetting.ViewModel
{
    public class OtherProduceViewModel:BaseScreen
    {
        private readonly IParamList _paramList;

        private RunSetting _runSetting;

        public RunSetting RunSetting
        {
            get => _runSetting;
            set
            {
                _runSetting = value;
                OnPropertyChanged("RunSetting");
            }
        }

        private GlobalRunParameter _globalRunParameter;

        public GlobalRunParameter GlobalRunParameter
        {
            get => _globalRunParameter;
            set
            {
                _globalRunParameter = value;
                OnPropertyChanged("GlobalRunParameter");
            }
        }

        private BondingProcessParameter _bondingProcessParameter;

        public BondingProcessParameter BondingProcessParameter
        {
            get => _bondingProcessParameter;
            set
            {
                _bondingProcessParameter = value;
                OnPropertyChanged("BondingProcessParameter");
            }
        }


        public OtherProduceViewModel(IParameterManager parameterManager)
        {
            _paramList = parameterManager as IParamList;
            if (_paramList == null)
            {
                throw new ArgumentNullException(nameof(parameterManager));
            }
        }

        protected override void OnViewLoaded()
        {
            base.OnViewLoaded();
            RunSetting = _paramList.GetParameter<RunSetting>();
            GlobalRunParameter = RunSetting.GlobalRunParameter;
            BondingProcessParameter = RunSetting.BondingProcessParameter;
        }

        public void BtnSave()
        {
            RunSetting.Write();
        }
    }
}
