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

namespace QC.QTMDotNetKernelInterface;

[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
public class DebugMessage
{
	private static bool eventsSetup = false;

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

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

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

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

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

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

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

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

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

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

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

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

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void Write(string debugWindowName, string debugText)
	{
		StaticMapper.GetDebugMessageObject().Write(debugWindowName, debugText, TraceLevel.Verbose);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void Write(string debugWindowName, string debugText, TraceLevel traceLevel)
	{
		StaticMapper.GetDebugMessageObject().Write(debugWindowName, debugText, traceLevel);
	}

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

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

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

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

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

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void Save(string debugWindowName, bool appendText)
	{
		StaticMapper.GetDebugMessageObject().Save(debugWindowName, appendText);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SaveAll(bool appendText)
	{
		StaticMapper.GetDebugMessageObject().SaveAll(appendText);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void PrintMessage(string debugWindowName, bool IsHeader, params string[] Values)
	{
		StaticMapper.GetDebugMessageObject().PrintMessage(debugWindowName, IsHeader, Values);
	}

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

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

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void TPLSetFilters(string debugWindowName, List<string> filterList)
	{
		StaticMapper.GetDebugMessageObject().TPLSetFilters(debugWindowName, filterList);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void TPLPrintMessage(string debugWindowName, string filter, string message)
	{
		StaticMapper.GetDebugMessageObject().TPLPrintMessage(debugWindowName, filter, message);
	}

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

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

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void TPLStartContext(string debugWindowName, string contextName, string contextType)
	{
		StaticMapper.GetDebugMessageObject().TPLStartContext(debugWindowName, contextName, contextType);
	}

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

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

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

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

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SendGenericMessage(string messageType, GenericTestData data = null, byte pluginTypes = 7, string pluginNames = "")
	{
		StaticMapper.GetDebugMessageObject().SendGenericMessage(messageType, data, pluginTypes, pluginNames);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SendGenericParamMessage(string messageType, string id = "", string name = "", string value = "", string units = "", string lowerLimit = "", string upperLimit = "", byte pluginTypes = 7, string pluginNames = "")
	{
		StaticMapper.GetDebugMessageObject().SendGenericParamMessage(messageType, id, name, value, units, lowerLimit, upperLimit, pluginTypes, pluginNames);
	}

	[Obsolete("This static class/method is obsolete, use QSPREnvironment instance to access this instead.")]
	public static void SendCustomMessage(object messageData, byte pluginTypes = 7, string pluginNames = "")
	{
		StaticMapper.GetDebugMessageObject().SendCustomMessage(messageData, pluginTypes, pluginNames);
	}

	internal static void SetupEvents()
	{
		if (!eventsSetup)
		{
			eventsSetup = true;
			StaticMapper.GetDebugMessageObject().OnClearAllDebugMsg += ENV_DebugMessage_OnClearAllDebugMsg;
			StaticMapper.GetDebugMessageObject().OnClearDebugMsg += ENV_DebugMessage_OnClearDebugMsg;
			StaticMapper.GetDebugMessageObject().OnCustomMsg += ENV_DebugMessage_OnCustomMsg;
			StaticMapper.GetDebugMessageObject().OnGenericMsg += ENV_DebugMessage_OnGenericMsg;
			StaticMapper.GetDebugMessageObject().OnGenericParamMsg += ENV_DebugMessage_OnGenericParamMsg;
			StaticMapper.GetDebugMessageObject().OnHTMLWindowMsg += ENV_DebugMessage_OnHTMLWindowMsg;
			StaticMapper.GetDebugMessageObject().OnPrintDebug += ENV_DebugMessage_OnPrintDebug;
			StaticMapper.GetDebugMessageObject().OnSaveAllDebugMsg += ENV_DebugMessage_OnSaveAllDebugMsg;
			StaticMapper.GetDebugMessageObject().OnSaveDebugMsg += ENV_DebugMessage_OnSaveDebugMsg;
			StaticMapper.GetDebugMessageObject().OnTextOut += ENV_DebugMessage_OnTextOut;
			StaticMapper.GetDebugMessageObject().OnTpl2WindowMsg += ENV_DebugMessage_OnTpl2WindowMsg;
			StaticMapper.GetDebugMessageObject().OnSetDebugWindowInFocus += ENV_DebugMessage_OnSetDebugWindowInFocus;
		}
	}

	private static void ENV_DebugMessage_OnSetDebugWindowInFocus(string debugWindowName)
	{
		if (DebugMessage.OnSetDebugWindowInFocus != null)
		{
			DebugMessage.OnSetDebugWindowInFocus(debugWindowName);
		}
	}

	private static void ENV_DebugMessage_OnTpl2WindowMsg(string debugWindowName, Tpl2Command command, Tpl2Info commandInfo)
	{
		if (DebugMessage.OnTpl2WindowMsg != null)
		{
			DebugMessage.OnTpl2WindowMsg(debugWindowName, command, commandInfo);
		}
	}

	private static void ENV_DebugMessage_OnTextOut(string debugWindowName, string debugText, TraceLevel traceLevel)
	{
		if (DebugMessage.OnTextOut != null)
		{
			DebugMessage.OnTextOut(debugWindowName, debugText, traceLevel);
		}
	}

	private static void ENV_DebugMessage_OnSaveDebugMsg(string debugWindowName, bool appendText)
	{
		if (DebugMessage.OnSaveDebugMsg != null)
		{
			DebugMessage.OnSaveDebugMsg(debugWindowName, appendText);
		}
	}

	private static void ENV_DebugMessage_OnSaveAllDebugMsg(bool appendText)
	{
		if (DebugMessage.OnSaveAllDebugMsg != null)
		{
			DebugMessage.OnSaveAllDebugMsg(appendText);
		}
	}

	private static void ENV_DebugMessage_OnPrintDebug(string debugWindowName, PrintMsgOptions IsHeader, params string[] Values)
	{
		if (DebugMessage.OnPrintDebug != null)
		{
			DebugMessage.OnPrintDebug(debugWindowName, IsHeader, Values);
		}
	}

	private static void ENV_DebugMessage_OnHTMLWindowMsg(string htmlWindowName, HTMLCommand command, string textStr)
	{
		if (DebugMessage.OnHTMLWindowMsg != null)
		{
			DebugMessage.OnHTMLWindowMsg(htmlWindowName, command, textStr);
		}
	}

	private static void ENV_DebugMessage_OnGenericParamMsg(string messageType, string id = "", string name = "", string value = "", string units = "", string lowerLimit = "", string upperLimit = "", byte pluginTypes = 7, string pluginNames = "")
	{
		if (DebugMessage.OnGenericParamMsg != null)
		{
			DebugMessage.OnGenericParamMsg(messageType, id, name, value, units, lowerLimit, upperLimit, pluginTypes, pluginNames);
		}
	}

	private static void ENV_DebugMessage_OnGenericMsg(string messageType, GenericTestData data = null, byte pluginTypes = 7, string pluginNames = "")
	{
		if (DebugMessage.OnGenericMsg != null)
		{
			DebugMessage.OnGenericMsg(messageType, data, pluginTypes, pluginNames);
		}
	}

	private static void ENV_DebugMessage_OnCustomMsg(object messageData, byte pluginTypes = 7, string pluginNames = "")
	{
		if (DebugMessage.OnCustomMsg != null)
		{
			DebugMessage.OnCustomMsg(messageData, pluginTypes, pluginNames);
		}
	}

	private static void ENV_DebugMessage_OnClearDebugMsg(string debugWindowName)
	{
		if (DebugMessage.OnClearDebugMsg != null)
		{
			DebugMessage.OnClearDebugMsg(debugWindowName);
		}
	}

	private static void ENV_DebugMessage_OnClearAllDebugMsg()
	{
		if (DebugMessage.OnClearAllDebugMsg != null)
		{
			DebugMessage.OnClearAllDebugMsg();
		}
	}
}
