using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace skyscraper5.src.Skyscraper
{
	/// <summary>
	/// Inspired by the Waters Instrument Qualitifcation Tool, this class contains methods to check for possible issues
	/// </summary>
	public static class QualificationTool
	{
		public static QualificationToolResultEnum QualifyTunerFactory(string ProductName, Version version)
		{
			switch(ProductName)
			{
				case "StreamReaderEx for BDA Tuners":
					return QualifyStreamReaderVersion(version);
				case "NullStreamReader": //We're not gonna spam multiple error messages because the tuner factory is missing
					return QualificationToolResultEnum.Good;
				default:
					Console.WriteLine("Unknown Tuner factory product: {0}", ProductName);
					return QualificationToolResultEnum.Unknown;
			}
		}

		public static QualificationToolResultEnum QualifyStreamReaderVersion(Version version)
		{
			string versionString = version.ToString();
			switch(versionString)
			{
				case "1.2.5.208": return QualificationToolResultEnum.Good;
				case "1.2.5.194": return QualificationToolResultEnum.Bad;	//Won't find most transponders with a 6903x
				case "1.2.5.176": return QualificationToolResultEnum.Bad;	//Won't find most transponders with a 6903x
				case "1.2.4.101": return QualificationToolResultEnum.Bad;	//Breaks GS encapsulation on 6903x.
				default: return QualificationToolResultEnum.Unknown;
			}
		}
	}

	public enum QualificationToolResultEnum : int
	{
		/// <summary>
		/// Use this if the product works 100% fine.
		/// </summary>
		Good = 1,
		/// <summary>
		/// Use this if the product works, but has minor hiccups which won't distract or annoy the user.
		/// </summary>
		PossibleIssues = 2,
		/// <summary>
		/// Use this if the product either doesn't work, or only works badly, meaning
		/// </summary>
		Bad = 3,
		Unknown
	}
}
