using System.Collections.Generic;

namespace QFDT_Components;

public class TechAndBandCombine
{
	public static readonly Dictionary<string, byte> techMap = new Dictionary<string, byte>
	{
		{ "CDMA", 0 },
		{ "WCDMA", 1 },
		{ "GSM", 2 },
		{ "LTE", 10 },
		{ "TDSCDMA", 11 },
		{ "NR5GSUB6", 18 }
	};

	public static readonly Dictionary<string, string> GSMBandChanDefaultMap = new Dictionary<string, string>
	{
		{ "0", "128,190,251" },
		{ "1", "975,37,124" },
		{ "2", "512,700,885" },
		{ "3", "512,661,810" }
	};

	public static readonly subBandInfoEnum[] subBandDef = new subBandInfoEnum[3]
	{
		new subBandInfoEnum(0, "No Split/Split A"),
		new subBandInfoEnum(1, "Split B"),
		new subBandInfoEnum(2, "Split C")
	};

	public string tech { get; set; }

	public string band { get; set; }

	public string subband { get; set; }

	public TechAndBandCombine()
	{
		tech = null;
		band = null;
		subband = null;
	}

	public TechAndBandCombine(string tech, string band, string subband)
	{
		this.tech = tech;
		this.band = band;
		this.subband = subband;
	}

	public override string ToString()
	{
		string text = "";
		if (tech != "GSM")
		{
			text = ((tech == "CDMA") ? " - BC" : " - B");
			text += band;
		}
		else if (band == "0")
		{
			text = " - GSM850";
		}
		else if (band == "1")
		{
			text = " - GSM900";
		}
		else if (band == "2")
		{
			text = " - GSM1800";
		}
		else if (band == "3")
		{
			text = " - GSM1900";
		}
		return tech + text + " - Subband " + subband;
	}

	public static ushort ChangeToBandHelperBandClass(string tech, string band)
	{
		ushort result = 0;
		int num = int.Parse(band);
		switch (tech)
		{
		case "WCDMA":
			result = (ushort)(num + 99);
			break;
		case "CDMA":
			result = (ushort)(num + 200);
			break;
		case "TDSCDMA":
			result = (ushort)(num + 999 - 32);
			break;
		case "LTE":
			result = (ushort)(num + 19999);
			break;
		case "GSM":
			switch (num)
			{
			case 0:
				result = 4;
				break;
			case 1:
				result = 0;
				break;
			case 2:
				result = 2;
				break;
			case 3:
				result = 3;
				break;
			}
			break;
		case "NR5GSUB6":
			result = (ushort)(num + 1499);
			break;
		}
		return result;
	}
}
