using Raytheon.Instruments;
using CryoMeasurementManagerLib;

using System;

namespace MeasurementManagerLib
{
	public class CryoMeasurementManager
	{
		private bool _isThereHardware;
		private ICommDevice _commDevice;
		private ICommDevice _serialDevice;

		public CryoMeasurementManager(bool isThereHardware, string measurementDefFile, string instrumentDefFile, string errorLogFileName)
		{
			if (measurementDefFile == null)
			{
				throw new ArgumentNullException("CryoMeasurementManager::CryoMeasurementManager() - measurementDefFile input parameter is null.");
			}
			if (instrumentDefFile == null)
			{
				throw new ArgumentNullException("CryoMeasurementManager::CryoMeasurementManager() - instrumentDefFile input parameter is null.");
			}
			if (errorLogFileName == null)
			{
				throw new ArgumentNullException("CryoMeasurementManager::CryoMeasurementManager() - errorLogFileName input parameter is null.");
			}
			_isThereHardware = isThereHardware;
		}

		/// <summary>
		/// constructor that uses instrument manager to create an instrument
		/// </summary>
		/// <param name="instrumentManaegr"></param>
		/// <param name="commDeviceName"></param>
		/// <param name="serialDeviceName"></param>
		/// <param name="isThereHardware"></param>
		/// <param name="errorLogFileName"></param>
		/// <exception cref="ArgumentNullException"></exception>
		public CryoMeasurementManager(IInstrumentManager instrumentManaegr, string commDeviceName, string serialDeviceName, bool isThereHardware, string errorLogFileName)
		{
			if (errorLogFileName == null)
			{
				throw new ArgumentNullException("CryoMeasurementManager::CryoMeasurementManager() - errorLogFileName input parameter is null.");
			}
			_isThereHardware = isThereHardware;

			if(!string.IsNullOrEmpty(commDeviceName))
			{
				_commDevice = instrumentManaegr.GetInstrument<ICommDevice>(commDeviceName);
			}

			if(!string.IsNullOrEmpty(serialDeviceName))
			{
				_serialDevice = instrumentManaegr.GetInstrument<ICommDevice>(serialDeviceName);
			}
		}

		public CryoMeasurementManager(string instrumentName, string errorLogFileName, bool isThereHardware)
		{
			_isThereHardware = isThereHardware;
		}


		private void SendMessageGetResponse(CryoMessage message)
		{
			try
			{
			}
			catch (Exception)
			{
				throw;
			}
		}

		public void StartFastCoolDown(object[] inputs)
		{
			try
			{
			}
			catch (Exception)
			{
				throw;
			}
		}

		public void StartLogging(string fileName)
		{
			try
			{
			}
			catch (Exception)
			{
				throw;
			}
		}

		public void StartSlowCoolDown(object[] inputs)
		{
			try
			{
			}
			catch (Exception)
			{
				throw;
			}
		}

		public void StopLogging()
		{
			try
			{
			}
			catch (Exception)
			{
				throw;
			}
		}
	}
}