using System.Text;

namespace QCRPG.TSL.ZigBee.Packets;

public static class DutaddressmodeInfo
{
	public static DutaddressmodeEnum ValueToDutaddressmode(uint value)
	{
		return value switch
		{
			0u => DutaddressmodeEnum.NO_ADDRESS, 
			1u => DutaddressmodeEnum.RESERVED, 
			2u => DutaddressmodeEnum.ShortAddress_16_BIT, 
			3u => DutaddressmodeEnum.ExtendedAddress_64_BIT, 
			_ => DutaddressmodeEnum.InvalidDutaddressmodeValue, 
		};
	}

	public static uint DutaddressmodeToValue(DutaddressmodeEnum enumItem)
	{
		return enumItem switch
		{
			DutaddressmodeEnum.NO_ADDRESS => 0u, 
			DutaddressmodeEnum.RESERVED => 1u, 
			DutaddressmodeEnum.ShortAddress_16_BIT => 2u, 
			DutaddressmodeEnum.ExtendedAddress_64_BIT => 3u, 
			_ => uint.MaxValue, 
		};
	}

	public static string DutaddressmodeToString(DutaddressmodeEnum enumItem)
	{
		return enumItem switch
		{
			DutaddressmodeEnum.NO_ADDRESS => "no address", 
			DutaddressmodeEnum.RESERVED => "RESERVED", 
			DutaddressmodeEnum.ShortAddress_16_BIT => "16-bit short address", 
			DutaddressmodeEnum.ExtendedAddress_64_BIT => "64-bit extended address", 
			_ => "Invalid Dutaddressmode Value", 
		};
	}

	public static string DutaddressmodeToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = no address");
		stringBuilder.AppendLine("0x1 = RESERVED");
		stringBuilder.AppendLine("0x2 = 16-bit short address");
		stringBuilder.AppendLine("0x3 = 64-bit extended address");
		return stringBuilder.ToString();
	}
}
