using System;
using System.ComponentModel;
using QC.QsprTestObjects.Parameters;
using QC.QsprTestObjects.TestConditions;
using QC.QsprTestObjects.Tests.Base;
using QC.QTMInterface;

namespace QC.QsprTestObjects.Tests.Hive;

[Serializable]
public class HiveTestProperties : TestProperties
{
	private enum eProcessProperties
	{
		STOP_ON_PASS = 1,
		STOP_ON_FAIL = 2,
		BRANCH_ON_PASS = 4,
		BRANCH_ON_FAIL = 8,
		STOP_MASK = 15,
		LOOP_ON = 16,
		LOOP_BY_COUNT = 32,
		LOOP_BY_PARAM = 64,
		LOOP_MASK = 112,
		DEBUG_FLAG = 128,
		DEBUG_MASK = 255,
		EMBEDDED = 256,
		EXEMPT = 512,
		OK_TO_LOOP = 1024,
		ANONYMOUS = 2048,
		SINGLETON = 4096,
		PROXY = 8192,
		IMMORTAL = 16384,
		SERIAL = 32768,
		SERIAL_GLOBAL = 65536,
		NOT_LOGGED = 131072,
		MUST_RUN = 262144,
		MUST_RUN_TREE = 524288,
		SKIP_CHECKSUM = 1048576,
		BOOKKEEPING = 2097152,
		SKIP = 8388608,
		ATTRIBUTE_MASK = 16776960,
		ATTRIBUTE_USER_MASK = 12386304,
		LOOP_FLAG = 16777216,
		SKIP_FLAG = 33554432,
		WARNING_FLAG = 67108864,
		FLAGS_MASK = 251658240,
		LINK = 268435456,
		LOCK = 536870912
	}

	private string dllName = "";

	private uint nodeProp;

	[Category("Settings")]
	[ReadOnly(true)]
	[Description("DLL name to which test belongs.")]
	[DefaultValue("")]
	public string DLLName
	{
		get
		{
			return dllName;
		}
		set
		{
			dllName = value;
		}
	}

	public uint HIVENodeProperties
	{
		get
		{
			return 0u;
		}
		set
		{
			nodeProp = value;
			if ((nodeProp & 2u) != 0)
			{
				StopOnError = StopOnErrorTypes.CompleteStop;
				PostCondition = null;
			}
			if ((nodeProp & (true ? 1u : 0u)) != 0)
			{
				PostCondition = new ConditionMgr();
				BaseCondition baseCondition = new BaseCondition();
				baseCondition.root = base.Owner.Root;
				baseCondition.Name = "C1";
				baseCondition.Result = QC.QTMInterface.TestResult.Passed;
				baseCondition.TestConditionType = ConditionType.TestResult;
				PostCondition.AddCondition(baseCondition);
				PostCondition.Action = PostConditionActions.CompleteStop;
				PostCondition.Expression = "C1";
				PostCondition.Enabled = true;
			}
			if ((nodeProp & 0x40000u) != 0)
			{
				TreeMustRun = true;
			}
			if ((nodeProp & 0x80000u) != 0)
			{
				TreeMustRun = true;
			}
			if ((nodeProp & 0x200000u) != 0)
			{
				BookKeeping = true;
			}
		}
	}

	public HiveTestProperties()
	{
	}

	public HiveTestProperties(object ParamColl)
	{
		parameters = new ParameterCollection(ParamColl);
	}

	public override TestProperties Clone()
	{
		HiveTestProperties hiveTestProperties = new HiveTestProperties();
		hiveTestProperties.dllName = dllName;
		Copy(hiveTestProperties);
		return hiveTestProperties;
	}
}
