using System;
using System.ComponentModel;
using System.Xml.Serialization;
using QC.QsprTestObjects.Tests.Base;
using QC.QTMInterface;
using QC.QTMInterface.Business_Objects;

namespace QC.QsprTestObjects.Tests.TestCase;

[Serializable]
public class TestCaseTestProperties : FolderTestProperties
{
	private long testCaseID = -1L;

	private long _testCaseMasterId = -1L;

	private string prIdList = "";

	private TestCaseTypes type;

	private string priority = "";

	private ExpectedResults expectedResult;

	private string testSteps = "";

	private ApprovalStates status = ApprovalStates.Draft;

	private string blockedCRNumber = string.Empty;

	private TimeSpan avgDuration;

	private string createdBy = "";

	private DateTime createDate;

	private uint version;

	private SetupTeardownType setupOrTeardown;

	private string testCaseTags = "";

	[Browsable(false)]
	public bool Dirty { get; set; }

	public override string TestName
	{
		get
		{
			return base.TestName;
		}
		set
		{
			base.TestName = value;
		}
	}

	[XmlIgnore]
	[Browsable(false)]
	public override bool HasThreeStateCheckbox => false;

	[Browsable(false)]
	[ReadOnly(true)]
	[Category("TestCase Attributes")]
	[Description("The unique auto-generated TestCase Version ID.")]
	public long TestCaseID
	{
		get
		{
			return testCaseID;
		}
		set
		{
			testCaseID = value;
		}
	}

	[Browsable(false)]
	[ReadOnly(true)]
	[Description("The unique auto-generated TestCase Master ID.")]
	[Category("TestCase Attributes")]
	public long TestCaseMasterID
	{
		get
		{
			return _testCaseMasterId;
		}
		set
		{
			_testCaseMasterId = value;
		}
	}

	[ReadOnly(true)]
	[DisplayName("ID")]
	[Category("TestCase Attributes")]
	[Description("The unique auto-generated TestCase Master ID.")]
	public long DisplayID { get; set; }

	[Category("TestCase Attributes")]
	[XmlIgnore]
	[ReadOnly(true)]
	[Description("The TestCase name.")]
	public string TestCaseName
	{
		get
		{
			return base.TestName;
		}
		set
		{
			base.TestName = value;
		}
	}

	[Category("TestCase Attributes")]
	[XmlIgnore]
	[ReadOnly(true)]
	[Description("The test case description.")]
	public string TestCaseDescription
	{
		get
		{
			return base.Description;
		}
		set
		{
			base.Description = value;
		}
	}

	[Category("TestCase Attributes")]
	[Browsable(false)]
	[ReadOnly(true)]
	[Description("The type of test case (either Automated or Manual).")]
	public TestCaseTypes Type
	{
		get
		{
			return type;
		}
		set
		{
			type = value;
		}
	}

	[Description("The test case status (approved, not approved, retired, etc.)")]
	[Category("TestCase Attributes")]
	[ReadOnly(true)]
	public ApprovalStates Status
	{
		get
		{
			return status;
		}
		set
		{
			status = value;
		}
	}

	[XmlIgnore]
	[ReadOnly(true)]
	[Category("TestCase Attributes")]
	public bool Blocked
	{
		get
		{
			return !string.IsNullOrEmpty(blockedCRNumber);
		}
		set
		{
		}
	}

	[ReadOnly(false)]
	[Category("TestCase Attributes")]
	[Description("The CR number blocking a test from passing, otherwise false.")]
	public string BlockedCRNumber
	{
		get
		{
			return blockedCRNumber;
		}
		set
		{
			if (blockedCRNumber != value)
			{
				blockedCRNumber = value;
				SetDirty();
			}
		}
	}

	[ReadOnly(true)]
	[Description("The test case version.")]
	[Category("TestCase Attributes")]
	public uint Version
	{
		get
		{
			return version;
		}
		set
		{
			version = value;
		}
	}

	[ReadOnly(true)]
	[Category("TestCase Attributes")]
	[Description("The test case modify time.")]
	public DateTime ModifiedDate { get; set; }

	public void SetDirty(bool isDirty = true)
	{
		Dirty = isDirty;
		base.Owner.TestUserInterfaceProperties.IsDirty = isDirty;
	}

	public override TestProperties Clone()
	{
		TestCaseTestProperties testCaseTestProperties = new TestCaseTestProperties();
		Copy(testCaseTestProperties);
		testCaseTestProperties.TestCaseID = testCaseID;
		testCaseTestProperties.TestCaseMasterID = TestCaseMasterID;
		testCaseTestProperties.DisplayID = DisplayID;
		testCaseTestProperties.TestCaseName = TestCaseName;
		testCaseTestProperties.TestCaseDescription = TestCaseDescription;
		testCaseTestProperties.Type = Type;
		testCaseTestProperties.Status = Status;
		testCaseTestProperties.Blocked = Blocked;
		testCaseTestProperties.BlockedCRNumber = BlockedCRNumber;
		testCaseTestProperties.Version = Version;
		testCaseTestProperties.ModifiedDate = ModifiedDate;
		return testCaseTestProperties;
	}
}
