using MainShell.DeviceMaintance.Model;
using MainShell.Hardware;
using MainShell.Motion;
using MainShell.Parameter;
using MaxwellFramework.Core.Interfaces;
using MwFramework.ManagerService;
using Stylet;
using System;
using System.Threading;

namespace MainShell.Process
{
    public class NeedleZCalibrationWorkflowData
    {
        public NeedleZCalibrationWorkflowData(string workflowName, int touchCount, bool autoRaiseZ1, CancellationToken cancellationToken, IEventAggregator eventAggregator, HardwareManager hardwareManager, SafeAxisMotion safeAxisMotion, IParameterManager parameterManager, IDeviceIoMonitorService deviceIoMonitorService)
        {
            if (string.IsNullOrWhiteSpace(workflowName))
            {
                throw new ArgumentException("workflowName");
            }

            WorkflowName = workflowName;
            TouchCount = touchCount;
            AutoRaiseZ1 = autoRaiseZ1;
            CancellationToken = cancellationToken;
            EventAggregator = eventAggregator;
            HardwareManager = hardwareManager ?? throw new ArgumentNullException(nameof(hardwareManager));
            SafeAxisMotion = safeAxisMotion ?? throw new ArgumentNullException(nameof(safeAxisMotion));
            ParameterManager = parameterManager ?? throw new ArgumentNullException(nameof(parameterManager));
            DeviceIoMonitorService = deviceIoMonitorService ?? throw new ArgumentNullException(nameof(deviceIoMonitorService));
        }

        public string WorkflowName { get; private set; }

        public int TouchCount { get; private set; }

        public bool AutoRaiseZ1 { get; private set; }

        public CancellationToken CancellationToken { get; private set; }

        public IEventAggregator EventAggregator { get; private set; }

        public HardwareManager HardwareManager { get; private set; }

        public SafeAxisMotion SafeAxisMotion { get; private set; }

        public IParameterManager ParameterManager { get; private set; }

        public IDeviceIoMonitorService DeviceIoMonitorService { get; private set; }

        public IParamList GetParameterList()
        {
            return ParameterManager as IParamList;
        }
    }
}
