using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class LeScanEnableInfo
{
	public static LeScanEnableEnum ValueToLeScanEnable(uint value)
	{
		switch (value)
		{
		case 0u:
			return LeScanEnableEnum.Scanning_disabled;
		case 1u:
			return LeScanEnableEnum.Scanning_enabled;
		default:
			if (value >= 2 && value <= 255)
			{
				return LeScanEnableEnum.Reserved_for_future_use;
			}
			return LeScanEnableEnum.InvalidLeScanEnableValue;
		}
	}

	public static uint LeScanEnableToValue(LeScanEnableEnum enumItem)
	{
		return enumItem switch
		{
			LeScanEnableEnum.Scanning_disabled => 0u, 
			LeScanEnableEnum.Scanning_enabled => 1u, 
			LeScanEnableEnum.Reserved_for_future_use => 2u, 
			_ => uint.MaxValue, 
		};
	}

	public static string LeScanEnableToString(LeScanEnableEnum enumItem)
	{
		return enumItem switch
		{
			LeScanEnableEnum.Scanning_disabled => "Scanning disabled", 
			LeScanEnableEnum.Scanning_enabled => "Scanning enabled", 
			LeScanEnableEnum.Reserved_for_future_use => "Reserved for future use", 
			_ => "Invalid LeScanEnable Value", 
		};
	}

	public static string LeScanEnableToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = Scanning disabled");
		stringBuilder.AppendLine("0x1 = Scanning enabled");
		stringBuilder.AppendLine("0x2-0xFF = Reserved for future use");
		return stringBuilder.ToString();
	}
}
