using System.Text;

namespace QCRPG.TSL.FMHCI.Packets;

public static class SignalThresholdInfo
{
	public static SignalThresholdEnum ValueToSignalThreshold(uint value)
	{
		return value switch
		{
			0u => SignalThresholdEnum.VERY_WEAK_ACCEPTABLE, 
			1u => SignalThresholdEnum.RELATIVELY_WEAK_ACCEPTABLE, 
			2u => SignalThresholdEnum.WEAK_ACCEPTABLE, 
			3u => SignalThresholdEnum.STRONG_ACCEPTABLE, 
			4u => SignalThresholdEnum.VERY_STRONG_ACCEPTABLE, 
			_ => SignalThresholdEnum.InvalidSignalThresholdValue, 
		};
	}

	public static uint SignalThresholdToValue(SignalThresholdEnum enumItem)
	{
		return enumItem switch
		{
			SignalThresholdEnum.VERY_WEAK_ACCEPTABLE => 0u, 
			SignalThresholdEnum.RELATIVELY_WEAK_ACCEPTABLE => 1u, 
			SignalThresholdEnum.WEAK_ACCEPTABLE => 2u, 
			SignalThresholdEnum.STRONG_ACCEPTABLE => 3u, 
			SignalThresholdEnum.VERY_STRONG_ACCEPTABLE => 4u, 
			_ => uint.MaxValue, 
		};
	}

	public static string SignalThresholdToString(SignalThresholdEnum enumItem)
	{
		return enumItem switch
		{
			SignalThresholdEnum.VERY_WEAK_ACCEPTABLE => "FM driver will consider stations with a very weak signal level to be acceptable", 
			SignalThresholdEnum.RELATIVELY_WEAK_ACCEPTABLE => "FM driver will consider stations with a relatively weak signal level to be acceptable", 
			SignalThresholdEnum.WEAK_ACCEPTABLE => "FM driver will consider stations with a weak signal level to be acceptable", 
			SignalThresholdEnum.STRONG_ACCEPTABLE => "FM driver will consider stations with a strong signal level to be acceptable", 
			SignalThresholdEnum.VERY_STRONG_ACCEPTABLE => "FM driver will consider stations with a very strong signal level to be acceptable", 
			_ => "Invalid SignalThreshold Value", 
		};
	}

	public static string SignalThresholdToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = FM driver will consider stations with a very weak signal level to be acceptable");
		stringBuilder.AppendLine("0x1 = FM driver will consider stations with a relatively weak signal level to be acceptable");
		stringBuilder.AppendLine("0x2 = FM driver will consider stations with a weak signal level to be acceptable");
		stringBuilder.AppendLine("0x3 = FM driver will consider stations with a strong signal level to be acceptable");
		stringBuilder.AppendLine("0x4 = FM driver will consider stations with a very strong signal level to be acceptable");
		return stringBuilder.ToString();
	}
}
