using System;
using System.ComponentModel;
using System.Reflection;

namespace QC.QSPRTreeSchemaLibrary;

[Serializable]
public class TestPlanProperties : RootTestProperties
{
	[ReadOnly(true)]
	public bool Dirty { get; set; }

	[Description("")]
	[ReadOnly(true)]
	[Category("Test Plan")]
	public string TestPlanName { get; set; }

	[Browsable(false)]
	[ReadOnly(true)]
	[Category("Test Plan")]
	[Description("The Database ID for this test plan.")]
	public long TestPlanVersionID { get; set; }

	[Browsable(false)]
	[Category("Test Plan")]
	[Description("The Database ID for this test plan.")]
	[ReadOnly(true)]
	public long TestPlanMasterID { get; set; }

	[ReadOnly(true)]
	[Category("Test Plan")]
	[Description("The Display ID for this test plan.")]
	public long ID { get; set; }

	[Category("Test Plan")]
	[ReadOnly(true)]
	[Description("The status of the test plan.")]
	public string Status { get; set; }

	[ReadOnly(true)]
	[Category("Test Plan")]
	[Description("The version of the test plan.")]
	public uint Version { get; set; }

	[Category("Settings")]
	[ReadOnly(true)]
	[Description("The DLL version loaded must be equal or greater than the DLL version the test was created with.")]
	public bool EnforceTestDllVersions => true;

	public TestPlanProperties()
	{
	}

	public TestPlanProperties(RootTestProperties source)
	{
		FieldInfo[] fields = typeof(RootTestProperties).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		TestPlanName = source.TestName;
		FieldInfo[] array = fields;
		foreach (FieldInfo fieldInfo in array)
		{
			fieldInfo.SetValue(this, fieldInfo.GetValue(source));
		}
	}

	public void SetDirty()
	{
		Dirty = true;
		Status = "Draft";
	}

	public void SetAsTestPlan()
	{
		base.TreeType = TreeTypes.TestPlan;
	}
}
