using System;
using System.Collections;
using System.Collections.Generic;
using QC.QTMInterface;

namespace QC.QTMDotNetKernelInterface;

[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
public class QTMInfo
{
	private static double DEFAULT_VALUE = -99999.0;

	private static List<string[]> parsedData = new List<string[]>();

	private static bool eventsSetup = false;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static string CurrentTestName => StaticMapper.GetQTMInfoObject().CurrentTestName;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static string CurrentLoopDetails => StaticMapper.GetQTMInfoObject().CurrentLoopDetails;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static string CurrentTestErrorCode => StaticMapper.GetQTMInfoObject().CurrentTestErrorCode;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static Hashtable ParamList => StaticMapper.GetQTMInfoObject().ParamList;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static bool CheckForStopMsg => StaticMapper.GetQTMInfoObject().CheckForStopMsg;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static bool CheckForAbortMsg => StaticMapper.GetQTMInfoObject().CheckForAbortMsg;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static bool CheckForAnyStopAbortMsg => StaticMapper.GetQTMInfoObject().CheckForAnyStopAbortMsg;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static string SN => StaticMapper.GetQTMInfoObject().SN;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static string MCN => StaticMapper.GetQTMInfoObject().MCN;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static string TESTERID => StaticMapper.GetQTMInfoObject().TESTERID;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static string WORKSTATION => StaticMapper.GetQTMInfoObject().WORKSTATION;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static event ToQTMMessageDelegate toQTMMessageReceived;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static event FromQTMMessageDelegate fromQTMMessageReceived;

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static object OnToQTMMessage(object sender, QTMMessageEventsArg e)
	{
		return StaticMapper.GetQTMInfoObject().OnToQTMMessage(sender, e);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void OnMsgFromQTM(TestMsgType msgType, MsgData message)
	{
		StaticMapper.GetQTMInfoObject().OnMsgFromQTM(msgType, message);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetErrorCode(string errorCode)
	{
		StaticMapper.GetQTMInfoObject().SetErrorCode(errorCode);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static string GetErrorCode()
	{
		return StaticMapper.GetQTMInfoObject().GetErrorCode();
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetStartAndStopTime(DateTime startTime, DateTime stopTime)
	{
		StaticMapper.GetQTMInfoObject().SetStartAndStopTime(startTime, stopTime);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetTestConfigItem(string key, string value)
	{
		StaticMapper.GetQTMInfoObject().SetTestConfigItem(key, value);
	}

	private static void RemoveExistingEntryIfExists(string key, MsgData msgData)
	{
		StaticMapper.GetQTMInfoObject().RemoveExistingEntryIfExists(key, msgData);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void LoadParamInfoFromCSV(string fullCSVFileName)
	{
		StaticMapper.GetQTMInfoObject().LoadParamInfoFromCSV(fullCSVFileName);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetCurrentTestName(string testName, string userDefinedTestName)
	{
		StaticMapper.GetQTMInfoObject().SetCurrentTestName(testName, userDefinedTestName);
	}

	private static MsgData GetCurrentTestDetailsMsg()
	{
		return StaticMapper.GetQTMInfoObject().GetCurrentTestDetailsMsg();
	}

	private static bool SetCurrentTestDetailsMsg(MsgData msgData)
	{
		return StaticMapper.GetQTMInfoObject().SetCurrentTestDetailsMsg(msgData);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static TestResultDetails GetCurrentTestDetails()
	{
		return StaticMapper.GetQTMInfoObject().GetCurrentTestDetails();
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetCurrentTestDetails(TestResultDetails resultDetails)
	{
		StaticMapper.GetQTMInfoObject().SetCurrentTestDetails(resultDetails);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetCurrentLogPath(string logPath)
	{
		StaticMapper.GetQTMInfoObject().SetCurrentLogPath(logPath);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetCurrentComments(string comments)
	{
		StaticMapper.GetQTMInfoObject().SetCurrentComments(comments);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetCurrentErrorCode(string errorCode, string errorDescription)
	{
		StaticMapper.GetQTMInfoObject().SetCurrentErrorCode(errorCode, errorDescription);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetCurrentErrorDescription(string errorDescription)
	{
		StaticMapper.GetQTMInfoObject().SetCurrentErrorDescription(errorDescription);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetCurrentWarning(string warning)
	{
		StaticMapper.GetQTMInfoObject().SetCurrentWarning(warning);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetCurrentIR(string IRID)
	{
		StaticMapper.GetQTMInfoObject().SetCurrentIR(IRID);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetCurrentJIRA(string JIRAID)
	{
		StaticMapper.GetQTMInfoObject().SetCurrentJIRA(JIRAID);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetAdditionalOutputParamaters(List<ParamValue> parameters)
	{
		StaticMapper.GetQTMInfoObject().SetAdditionalOutputParamaters(parameters);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetCurrentCR(string CRID)
	{
		StaticMapper.GetQTMInfoObject().SetCurrentCR(CRID);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SetCurrentSR(string SRID)
	{
		StaticMapper.GetQTMInfoObject().SetCurrentSR(SRID);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static double ParamLL(string paramName)
	{
		return StaticMapper.GetQTMInfoObject().ParamLL(paramName);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static double ParamLL(string paramName, int index)
	{
		return StaticMapper.GetQTMInfoObject().ParamLL(paramName, index);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static double ParamUL(string paramName)
	{
		return StaticMapper.GetQTMInfoObject().ParamUL(paramName);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static double ParamUL(string paramName, int index)
	{
		return StaticMapper.GetQTMInfoObject().ParamUL(paramName, index);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static string ParamUOM(string paramName)
	{
		return StaticMapper.GetQTMInfoObject().ParamUOM(paramName);
	}

	internal static void SetupEvents()
	{
		if (!eventsSetup)
		{
			eventsSetup = true;
			StaticMapper.GetQTMInfoObject().fromQTMMessageReceived += ENV_QTMInfo_fromQTMMessageReceived;
			StaticMapper.GetQTMInfoObject().toQTMMessageReceived += ENV_QTMInfo_toQTMMessageReceived;
		}
	}

	private static object ENV_QTMInfo_toQTMMessageReceived(object sender, QTMMessageEventsArg e)
	{
		if (QTMInfo.toQTMMessageReceived != null)
		{
			return QTMInfo.toQTMMessageReceived(sender, e);
		}
		return null;
	}

	private static void ENV_QTMInfo_fromQTMMessageReceived(TestMsgType msgType, MsgData message)
	{
		if (QTMInfo.fromQTMMessageReceived != null)
		{
			QTMInfo.fromQTMMessageReceived(msgType, message);
		}
	}
}
