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

namespace QC.QSPRLogSchema;

[Serializable]
[XmlType(AnonymousType = true)]
public class Output : IEquatable<Output>
{
	[DebuggerBrowsable(DebuggerBrowsableState.Never)]
	private List<OutputItem> resField;

	[DebuggerBrowsable(DebuggerBrowsableState.Never)]
	private List<ArrayOutputItem> arrResField;

	[XmlElement("Res")]
	public List<OutputItem> Outputs
	{
		get
		{
			return resField;
		}
		set
		{
			resField = value;
		}
	}

	[XmlElement("ArrRes")]
	public List<ArrayOutputItem> ArrayOutputs
	{
		get
		{
			return arrResField;
		}
		set
		{
			arrResField = value;
		}
	}

	public bool ShouldSerializeOutputs()
	{
		if (Outputs != null)
		{
			return Outputs.Count > 0;
		}
		return false;
	}

	public bool ShouldSerializeArrayOutputs()
	{
		if (ArrayOutputs != null)
		{
			return ArrayOutputs.Count > 0;
		}
		return false;
	}

	public Output()
	{
		resField = new List<OutputItem>();
		arrResField = new List<ArrayOutputItem>();
	}

	public Output(List<OutputItem> res = null, List<ArrayOutputItem> arrRes = null)
	{
		if (res != null)
		{
			resField = res;
		}
		else
		{
			resField = new List<OutputItem>();
		}
		if (arrRes != null)
		{
			arrResField = arrRes;
		}
		else
		{
			arrResField = new List<ArrayOutputItem>();
		}
	}

	public bool Equals(Output other)
	{
		bool result = false;
		if (Outputs.Count == other.Outputs.Count && ArrayOutputs.Count == other.ArrayOutputs.Count)
		{
			foreach (OutputItem output in Outputs)
			{
				if (!other.Outputs.Contains(output))
				{
					return result;
				}
			}
			foreach (ArrayOutputItem arrayOutput in ArrayOutputs)
			{
				if (!other.ArrayOutputs.Contains(arrayOutput))
				{
					return result;
				}
			}
			result = true;
		}
		return result;
	}

	public void Clear()
	{
		resField.Clear();
		arrResField.Clear();
	}
}
