using System.Text;

namespace QCRPG.TSL.ZigBee.Packets;

public static class TestPacketTypeInfo
{
	public static TestPacketTypeEnum ValueToTestPacketType(uint value)
	{
		return value switch
		{
			0u => TestPacketTypeEnum.PRBS9, 
			1u => TestPacketTypeEnum.PRBS16, 
			2u => TestPacketTypeEnum.ALL_1, 
			3u => TestPacketTypeEnum.ALL_0, 
			4u => TestPacketTypeEnum.ALT_0101, 
			5u => TestPacketTypeEnum.ALT_1010, 
			_ => TestPacketTypeEnum.InvalidTestPacketTypeValue, 
		};
	}

	public static uint TestPacketTypeToValue(TestPacketTypeEnum enumItem)
	{
		return enumItem switch
		{
			TestPacketTypeEnum.PRBS9 => 0u, 
			TestPacketTypeEnum.PRBS16 => 1u, 
			TestPacketTypeEnum.ALL_1 => 2u, 
			TestPacketTypeEnum.ALL_0 => 3u, 
			TestPacketTypeEnum.ALT_0101 => 4u, 
			TestPacketTypeEnum.ALT_1010 => 5u, 
			_ => uint.MaxValue, 
		};
	}

	public static string TestPacketTypeToString(TestPacketTypeEnum enumItem)
	{
		return enumItem switch
		{
			TestPacketTypeEnum.PRBS9 => "PRBS9", 
			TestPacketTypeEnum.PRBS16 => "PRBS16", 
			TestPacketTypeEnum.ALL_1 => "ALL_1", 
			TestPacketTypeEnum.ALL_0 => "ALL_0", 
			TestPacketTypeEnum.ALT_0101 => "ALT_0101", 
			TestPacketTypeEnum.ALT_1010 => "ALT_1010", 
			_ => "Invalid TestPacketType Value", 
		};
	}

	public static string TestPacketTypeToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = PRBS9");
		stringBuilder.AppendLine("0x1 = PRBS16");
		stringBuilder.AppendLine("0x2 = ALL_1");
		stringBuilder.AppendLine("0x3 = ALL_0");
		stringBuilder.AppendLine("0x4 = ALT_0101");
		stringBuilder.AppendLine("0x5 = ALT_1010");
		return stringBuilder.ToString();
	}
}
