using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class VoiceLoopbackModeInfo
{
	public static VoiceLoopbackModeEnum ValueToVoiceLoopbackMode(uint value)
	{
		return value switch
		{
			0u => VoiceLoopbackModeEnum.Disabled, 
			1u => VoiceLoopbackModeEnum.Local_At_ACI, 
			2u => VoiceLoopbackModeEnum.Local_At_CODEC, 
			5u => VoiceLoopbackModeEnum.Local_At_OTA, 
			_ => VoiceLoopbackModeEnum.InvalidVoiceLoopbackModeValue, 
		};
	}

	public static uint VoiceLoopbackModeToValue(VoiceLoopbackModeEnum enumItem)
	{
		return enumItem switch
		{
			VoiceLoopbackModeEnum.Disabled => 0u, 
			VoiceLoopbackModeEnum.Local_At_ACI => 1u, 
			VoiceLoopbackModeEnum.Local_At_CODEC => 2u, 
			VoiceLoopbackModeEnum.Local_At_OTA => 5u, 
			_ => uint.MaxValue, 
		};
	}

	public static string VoiceLoopbackModeToString(VoiceLoopbackModeEnum enumItem)
	{
		return enumItem switch
		{
			VoiceLoopbackModeEnum.Disabled => "Disable loopback mode", 
			VoiceLoopbackModeEnum.Local_At_ACI => "Local loopback at ACI", 
			VoiceLoopbackModeEnum.Local_At_CODEC => "Local loopback at CODEC", 
			VoiceLoopbackModeEnum.Local_At_OTA => "Local loopback at BB", 
			_ => "Invalid VoiceLoopbackMode Value", 
		};
	}

	public static string VoiceLoopbackModeToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = Disable loopback mode");
		stringBuilder.AppendLine("0x1 = Local loopback at ACI");
		stringBuilder.AppendLine("0x2 = Local loopback at CODEC");
		stringBuilder.AppendLine("0x5 = Local loopback at BB");
		return stringBuilder.ToString();
	}
}
