using System.Text;

namespace QCRPG.TSL.ZigBee.Packets;

public static class SecurityLevelOptionsInfo
{
	public static SecurityLevelOptionsEnum ValueToSecurityLevelOptions(uint value)
	{
		return value switch
		{
			0u => SecurityLevelOptionsEnum.None, 
			1u => SecurityLevelOptionsEnum.MIC_32, 
			2u => SecurityLevelOptionsEnum.MIC_64, 
			3u => SecurityLevelOptionsEnum.MIC_128, 
			4u => SecurityLevelOptionsEnum.ENC, 
			5u => SecurityLevelOptionsEnum.ENC_MIC_32, 
			6u => SecurityLevelOptionsEnum.ENC_MIC_64, 
			7u => SecurityLevelOptionsEnum.ENC_MIC_128, 
			_ => SecurityLevelOptionsEnum.InvalidSecurityLevelOptionsValue, 
		};
	}

	public static uint SecurityLevelOptionsToValue(SecurityLevelOptionsEnum enumItem)
	{
		return enumItem switch
		{
			SecurityLevelOptionsEnum.None => 0u, 
			SecurityLevelOptionsEnum.MIC_32 => 1u, 
			SecurityLevelOptionsEnum.MIC_64 => 2u, 
			SecurityLevelOptionsEnum.MIC_128 => 3u, 
			SecurityLevelOptionsEnum.ENC => 4u, 
			SecurityLevelOptionsEnum.ENC_MIC_32 => 5u, 
			SecurityLevelOptionsEnum.ENC_MIC_64 => 6u, 
			SecurityLevelOptionsEnum.ENC_MIC_128 => 7u, 
			_ => uint.MaxValue, 
		};
	}

	public static string SecurityLevelOptionsToString(SecurityLevelOptionsEnum enumItem)
	{
		return enumItem switch
		{
			SecurityLevelOptionsEnum.None => "None", 
			SecurityLevelOptionsEnum.MIC_32 => "MIC-32", 
			SecurityLevelOptionsEnum.MIC_64 => "MIC-64", 
			SecurityLevelOptionsEnum.MIC_128 => "MIC-128", 
			SecurityLevelOptionsEnum.ENC => "ENC", 
			SecurityLevelOptionsEnum.ENC_MIC_32 => "ENC-MIC-32", 
			SecurityLevelOptionsEnum.ENC_MIC_64 => "ENC-MIC-64", 
			SecurityLevelOptionsEnum.ENC_MIC_128 => "ENC-MIC-128", 
			_ => "Invalid SecurityLevelOptions Value", 
		};
	}

	public static string SecurityLevelOptionsToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = None");
		stringBuilder.AppendLine("0x1 = MIC-32");
		stringBuilder.AppendLine("0x2 = MIC-64");
		stringBuilder.AppendLine("0x3 = MIC-128");
		stringBuilder.AppendLine("0x4 = ENC");
		stringBuilder.AppendLine("0x5 = ENC-MIC-32");
		stringBuilder.AppendLine("0x6 = ENC-MIC-64");
		stringBuilder.AppendLine("0x7 = ENC-MIC-128");
		return stringBuilder.ToString();
	}
}
