using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class SimplePairingModeInfo
{
	public static SimplePairingModeEnum ValueToSimplePairingMode(uint value)
	{
		switch (value)
		{
		case 0u:
			return SimplePairingModeEnum.Simple_Pairing_not_set;
		case 1u:
			return SimplePairingModeEnum.Simple_pairing_enabled;
		default:
			if (value >= 2 && value <= 255)
			{
				return SimplePairingModeEnum.RESERVED;
			}
			return SimplePairingModeEnum.InvalidSimplePairingModeValue;
		}
	}

	public static uint SimplePairingModeToValue(SimplePairingModeEnum enumItem)
	{
		return enumItem switch
		{
			SimplePairingModeEnum.Simple_Pairing_not_set => 0u, 
			SimplePairingModeEnum.Simple_pairing_enabled => 1u, 
			SimplePairingModeEnum.RESERVED => 2u, 
			_ => uint.MaxValue, 
		};
	}

	public static string SimplePairingModeToString(SimplePairingModeEnum enumItem)
	{
		return enumItem switch
		{
			SimplePairingModeEnum.Simple_Pairing_not_set => "Simple_Pairing_not_set", 
			SimplePairingModeEnum.Simple_pairing_enabled => "Simple_pairing_enabled", 
			SimplePairingModeEnum.RESERVED => "Reserved", 
			_ => "Invalid SimplePairingMode Value", 
		};
	}

	public static string SimplePairingModeToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = Simple_Pairing_not_set");
		stringBuilder.AppendLine("0x1 = Simple_pairing_enabled");
		stringBuilder.AppendLine("0x2-0xFF = Reserved");
		return stringBuilder.ToString();
	}
}
