using System;
using System.Diagnostics;
using System.Xml.Serialization;

namespace QC.QSPRLogSchema;

[Serializable]
[XmlType(AnonymousType = true)]
public class UUT
{
	[DebuggerBrowsable(DebuggerBrowsableState.Never)]
	private SoftwareConfiguration swConfigField;

	[DebuggerBrowsable(DebuggerBrowsableState.Never)]
	private HardwareConfiguration hwConfigField;

	[DebuggerBrowsable(DebuggerBrowsableState.Never)]
	private string idField;

	[XmlElement("SWConfig")]
	public SoftwareConfiguration SoftwareConfiguration
	{
		get
		{
			return swConfigField;
		}
		set
		{
			swConfigField = value;
		}
	}

	[XmlElement("HWConfig")]
	public HardwareConfiguration HardwareConfiguration
	{
		get
		{
			return hwConfigField;
		}
		set
		{
			hwConfigField = value;
		}
	}

	[XmlAttribute]
	public string Id
	{
		get
		{
			return idField;
		}
		set
		{
			idField = value;
		}
	}

	public bool ShouldSerializeSoftwareConfiguration()
	{
		if (SoftwareConfiguration != null)
		{
			if (!SoftwareConfiguration.ShouldSerializeSoftwareBuildID())
			{
				return SoftwareConfiguration.ShouldSerializeImage();
			}
			return true;
		}
		return false;
	}

	public bool ShouldSerializeHardwareConfiguration()
	{
		if (HardwareConfiguration != null)
		{
			if (!HardwareConfiguration.ShouldSerializeId() && !HardwareConfiguration.ShouldSerializeWLanRF())
			{
				return HardwareConfiguration.ShouldSerializeWWanRF();
			}
			return true;
		}
		return false;
	}

	public bool ShouldSerializeId()
	{
		return !string.IsNullOrEmpty(Id);
	}

	public UUT()
	{
		swConfigField = new SoftwareConfiguration();
		hwConfigField = new HardwareConfiguration();
		idField = string.Empty;
	}

	public UUT(SoftwareConfiguration swConfig = null, HardwareConfiguration hwConfig = null, string id = null)
	{
		if (swConfig != null)
		{
			swConfigField = swConfig;
		}
		else
		{
			swConfigField = new SoftwareConfiguration();
		}
		if (hwConfig != null)
		{
			hwConfigField = hwConfig;
		}
		else
		{
			hwConfigField = new HardwareConfiguration();
		}
		if (!string.IsNullOrEmpty(id))
		{
			idField = id;
		}
		else
		{
			idField = string.Empty;
		}
	}
}
