using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace QC.QSPRLogSchema;

[Serializable]
[XmlType(AnonymousType = true)]
public class LogConfiguration
{
	[XmlArray("AllowedMessages", IsNullable = false)]
	[XmlArrayItem(typeof(TestMsgType), ElementName = "MessageType")]
	public List<TestMsgType> AllowedMessages;

	public string OutputFileLocation { get; set; }

	public string SendEmail { get; set; }

	public string EmailTo { get; set; }

	public string TrackingEmailTo { get; set; }

	public string EmailCurrentUser { get; set; }

	public string CopyLogs { get; set; }

	public string LogCopyPath { get; set; }

	public string StyleSheetPath { get; set; }

	public string WriteXML { get; set; }

	public string AppendMachineName { get; set; }

	public string UseCustomFormatter { get; set; }

	public string XMLFilePath { get; set; }

	public string CustomFormatterPath { get; set; }

	public string FileName { get; set; }

	public string QSPRVersion { get; set; }

	[XmlElement(IsNullable = false)]
	public string LastSessionDataGUID { get; set; }

	public bool IncludeTestCaseID { get; set; }

	public bool IncludeKPI { get; set; }

	public bool IncludeSkippedTestCases { get; set; }

	public bool ShouldSerializeOutputFileLocation()
	{
		return !string.IsNullOrEmpty(OutputFileLocation);
	}

	public bool ShouldSerializeSendEmail()
	{
		return !string.IsNullOrEmpty(SendEmail);
	}

	public bool ShouldSerializeEmailTo()
	{
		return !string.IsNullOrEmpty(EmailTo);
	}

	public bool ShouldSerializeTrackingEmailTo()
	{
		return !string.IsNullOrEmpty(TrackingEmailTo);
	}

	public bool ShouldSerializeEmailCurrentUser()
	{
		return !string.IsNullOrEmpty(EmailCurrentUser);
	}

	public bool ShouldSerializeCopyLogs()
	{
		return !string.IsNullOrEmpty(CopyLogs);
	}

	public bool ShouldSerializeLogCopyPath()
	{
		return !string.IsNullOrEmpty(LogCopyPath);
	}

	public bool ShouldSerializeStyleSheetPath()
	{
		return !string.IsNullOrEmpty(StyleSheetPath);
	}

	public bool ShouldSerializeWriteXML()
	{
		return !string.IsNullOrEmpty(WriteXML);
	}

	public bool ShouldSerializeAppendMachineName()
	{
		return !string.IsNullOrEmpty(AppendMachineName);
	}

	public bool ShouldSerializeUseCustomFormatter()
	{
		return !string.IsNullOrEmpty(UseCustomFormatter);
	}

	public bool ShouldSerializeXMLFilePath()
	{
		return !string.IsNullOrEmpty(XMLFilePath);
	}

	public bool ShouldSerializeCustomFormatterPath()
	{
		return !string.IsNullOrEmpty(CustomFormatterPath);
	}

	public bool ShouldSerializeFileName()
	{
		return !string.IsNullOrEmpty(FileName);
	}

	public bool ShouldSerializeQSPRVersion()
	{
		return !string.IsNullOrEmpty(QSPRVersion);
	}

	public LogConfiguration()
	{
		OutputFileLocation = string.Empty;
		SendEmail = "true";
		EmailTo = "cst.qspr.reports@qualcomm.com";
		TrackingEmailTo = string.Empty;
		EmailCurrentUser = "true";
		CopyLogs = "true";
		LogCopyPath = string.Empty;
		WriteXML = "true";
		AppendMachineName = "true";
		UseCustomFormatter = "false";
		XMLFilePath = "c:\\qualcomm\\qspr\\testlog";
		CustomFormatterPath = string.Empty;
		FileName = string.Empty;
		AllowedMessages = new List<TestMsgType>
		{
			TestMsgType.OnUnitStart,
			TestMsgType.OnTestResult,
			TestMsgType.OnTestSkipped,
			TestMsgType.OnUnitEnd,
			TestMsgType.OnFolderStart,
			TestMsgType.OnFolderEnd,
			TestMsgType.OnTestStart
		};
	}
}
