using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using QC.QTMInterface.Business_Objects;

namespace QC.QTMInterface;

public abstract class TestCasesPlugin : BasePlugin
{
	public delegate CallbackResultInfo TTDPluginHandler(object sender, TTDPluginEventArgs e);

	public TTDPluginHandler OnTTDPluginHandler;

	public Action<List<TestCaseMaster>> OnRequestTestCasesByIdResult;

	private bool getDebugMsg;

	public abstract Action PluginInitialized { get; set; }

	public virtual string XmlTreeName
	{
		get
		{
			return "";
		}
		set
		{
		}
	}

	public virtual string Caption => string.Empty;

	public virtual ImageList ToolImages => null;

	public virtual ArrayList ToolbarItems => null;

	public virtual bool GetDebugMsg => getDebugMsg;

	public virtual event TTDSubmitClickHandler submitClicked;

	public abstract event GetTestCasesEventHandler OnGetTestCases;

	public virtual event LoadTestPlanEventHandler OnLoadTestPlan;

	public virtual event SendMenuMessageEventHandler OnSendMenuMessage;

	public virtual event TestPlanCreatedEventHandler OnTestPlanCreated;

	public virtual event TestCaseCreatedEventHandler OnTestCasesCreated;

	public virtual event RequestSerializedTestCaseEventHandler OnRequestSerializedTestCase;

	public virtual event SendTCSkipAPIBaseURLEventHandler OnSendTCSkipAPIBaseURL;

	public virtual void CreateTestCase(object test)
	{
	}

	public abstract void RequestTestCases(List<TestCaseMaster> testCases, bool wasManualUpdateRequest, bool forceUpdateOrRevert);

	public abstract void RequestTestCasesByVersionIds(List<long> testCaseVersionIds);

	public abstract void FindTestCasesInDatabase(List<TestCaseMaster> testCases);

	public virtual void SaveTestPlan(TestPlanMaster testPlanMaster)
	{
	}

	public virtual void LoadTestPlan(long Id, int versionNumber, string databaseServer, string databaseName)
	{
	}

	public virtual void LoadTestPlanByName(string name, int versionNumber, string databaseServer, string databaseName)
	{
	}

	public virtual bool CanCreateTestPlan()
	{
		return true;
	}

	public abstract TestCaseMaster GetTestCase(long id, uint version);

	protected void DoClick(EventArgs e)
	{
		if (this.submitClicked != null)
		{
			this.submitClicked(this, e);
		}
	}

	public void SendSkipTcAPIBase(SendTCSkipAPIBaseURLEventArgs args)
	{
		if (this.OnSendTCSkipAPIBaseURL != null)
		{
			this.OnSendTCSkipAPIBaseURL(this, args);
		}
	}

	public void SendMenuMessage(SendMenuMessageEventArgs args)
	{
		if (this.OnSendMenuMessage != null)
		{
			this.OnSendMenuMessage(this, args);
		}
	}

	public void LoadTestPlan(LoadTestPlanEventArgs args)
	{
		if (this.OnLoadTestPlan != null)
		{
			this.OnLoadTestPlan(this, args);
		}
	}

	public void TestCaseCreated(List<TestCaseMaster> testCaseMasters, List<string> testIndexList)
	{
		if (this.OnTestCasesCreated != null)
		{
			this.OnTestCasesCreated(this, new TestCaseCreatedEventArgs
			{
				TestCases = testCaseMasters,
				TestIndexList = testIndexList
			});
		}
	}

	public void TestPlanCreated(TestPlanMaster testPlanMaster)
	{
		if (this.OnTestPlanCreated != null)
		{
			this.OnTestPlanCreated(this, new TestPlanCreatedEventArgs
			{
				TestPlan = testPlanMaster
			});
		}
	}

	public void RequestSerializedTestCase(TestCaseMaster tcMaster)
	{
		if (this.OnRequestSerializedTestCase != null)
		{
			this.OnRequestSerializedTestCase(this, new SerializeTestCaseEventArgs
			{
				TCMaster = tcMaster
			});
		}
	}

	public virtual void TestCaseSerialized(TestCaseMaster tcMaster, string serializedXml)
	{
	}

	public virtual void CalledFromMainAppFunction()
	{
	}

	public virtual ArrayList GetConfiguration()
	{
		return null;
	}

	public virtual ArrayList GetConfiguration(string testerConfgiFile, bool refresh)
	{
		return null;
	}

	public virtual void OnDebugMsg(DebugMsgType msgType, object msgInfo)
	{
	}

	public virtual string GetTestCaseServerName()
	{
		return "";
	}

	public virtual string GetTestCaseDatabaseName()
	{
		return "";
	}

	public virtual void GetTestCases(string _fileName)
	{
		throw new NotImplementedException();
	}
}
