using System.Collections.Generic;
using QC.QTMXmlSchema;

namespace QC.XmlToDBPreProcess;

public static class BaseProcess
{
	public static ConversionType ApplyPreProcessType(ref ROOT qtmXml, Dictionary<string, string[]> PreProcessArguments)
	{
		ConversionType result = ConversionType.All;
		foreach (KeyValuePair<string, string[]> PreProcessArgument in PreProcessArguments)
		{
			switch (PreProcessArgument.Key)
			{
			case "Parametric":
				result = new ConfigParametricPreProcessor().ApplyPreProcessType(ref qtmXml, PreProcessArgument.Value);
				break;
			case "Session":
				result = new SessionData().ApplyPreProcessType(ref qtmXml, PreProcessArgument.Value);
				break;
			case "Extended":
				result = new ExtendedData().ApplyPreProcessType(ref qtmXml, PreProcessArgument.Value);
				break;
			case "SplitErrorCode":
				result = new SplitErrorCode().ApplyPreProcessType(ref qtmXml, PreProcessArgument.Value);
				break;
			}
		}
		return result;
	}
}
