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

namespace QC.QSPRLogSchema;

[Serializable]
[XmlType(AnonymousType = true)]
public class InputItem : IEquatable<InputItem>
{
	[DebuggerBrowsable(DebuggerBrowsableState.Never)]
	private string nField;

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

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

	[XmlAttribute("N")]
	public string Name
	{
		get
		{
			return nField;
		}
		set
		{
			nField = value;
		}
	}

	[XmlAttribute("V")]
	public string Value
	{
		get
		{
			return vField;
		}
		set
		{
			vField = value;
		}
	}

	[XmlAttribute("U")]
	public string Unit
	{
		get
		{
			return uField;
		}
		set
		{
			uField = value;
		}
	}

	public bool ShouldSerializeName()
	{
		return !string.IsNullOrEmpty(Name);
	}

	public bool ShouldSerializeValue()
	{
		return !string.IsNullOrEmpty(Value);
	}

	public bool ShouldSerializeUnit()
	{
		return !string.IsNullOrEmpty(Unit);
	}

	public InputItem()
	{
		nField = string.Empty;
		vField = string.Empty;
		uField = string.Empty;
	}

	public InputItem(string n = null, string v = null, string u = null)
	{
		if (!string.IsNullOrEmpty(n))
		{
			nField = n;
		}
		else
		{
			nField = string.Empty;
		}
		if (!string.IsNullOrEmpty(v))
		{
			vField = v;
		}
		else
		{
			vField = string.Empty;
		}
		if (!string.IsNullOrEmpty(u))
		{
			uField = u;
		}
		else
		{
			uField = string.Empty;
		}
	}

	public bool Equals(InputItem other)
	{
		if (Name.Equals(other.Name) && Value.Equals(other.Value))
		{
			return Unit.Equals(other.Unit);
		}
		return false;
	}
}
