using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class AdvertisingEnableInfo
{
	public static AdvertisingEnableEnum ValueToAdvertisingEnable(uint value)
	{
		switch (value)
		{
		case 0u:
			return AdvertisingEnableEnum.Advertising_is_disabled;
		case 1u:
			return AdvertisingEnableEnum.Advertising_is_enabled;
		default:
			if (value >= 2 && value <= 255)
			{
				return AdvertisingEnableEnum.Reserved_for_future_use;
			}
			return AdvertisingEnableEnum.InvalidAdvertisingEnableValue;
		}
	}

	public static uint AdvertisingEnableToValue(AdvertisingEnableEnum enumItem)
	{
		return enumItem switch
		{
			AdvertisingEnableEnum.Advertising_is_disabled => 0u, 
			AdvertisingEnableEnum.Advertising_is_enabled => 1u, 
			AdvertisingEnableEnum.Reserved_for_future_use => 2u, 
			_ => uint.MaxValue, 
		};
	}

	public static string AdvertisingEnableToString(AdvertisingEnableEnum enumItem)
	{
		return enumItem switch
		{
			AdvertisingEnableEnum.Advertising_is_disabled => "Advertising is disabled", 
			AdvertisingEnableEnum.Advertising_is_enabled => "Advertising is enabled", 
			AdvertisingEnableEnum.Reserved_for_future_use => "Reserved for future use", 
			_ => "Invalid AdvertisingEnable Value", 
		};
	}

	public static string AdvertisingEnableToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = Advertising is disabled");
		stringBuilder.AppendLine("0x1 = Advertising is enabled");
		stringBuilder.AppendLine("0x2-0xFF = Reserved for future use");
		return stringBuilder.ToString();
	}
}
