using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class PageScanPeriodModeInfo
{
	public static PageScanPeriodModeEnum ValueToPageScanPeriodMode(uint value)
	{
		switch (value)
		{
		case 0u:
			return PageScanPeriodModeEnum.P0;
		case 1u:
			return PageScanPeriodModeEnum.P1;
		case 2u:
			return PageScanPeriodModeEnum.P2;
		default:
			if (value >= 3 && value <= 255)
			{
				return PageScanPeriodModeEnum.RESERVED;
			}
			return PageScanPeriodModeEnum.InvalidPageScanPeriodModeValue;
		}
	}

	public static uint PageScanPeriodModeToValue(PageScanPeriodModeEnum enumItem)
	{
		return enumItem switch
		{
			PageScanPeriodModeEnum.P0 => 0u, 
			PageScanPeriodModeEnum.P1 => 1u, 
			PageScanPeriodModeEnum.P2 => 2u, 
			PageScanPeriodModeEnum.RESERVED => 3u, 
			_ => uint.MaxValue, 
		};
	}

	public static string PageScanPeriodModeToString(PageScanPeriodModeEnum enumItem)
	{
		return enumItem switch
		{
			PageScanPeriodModeEnum.P0 => "P0", 
			PageScanPeriodModeEnum.P1 => "P1", 
			PageScanPeriodModeEnum.P2 => "P2", 
			PageScanPeriodModeEnum.RESERVED => "Reserved", 
			_ => "Invalid PageScanPeriodMode Value", 
		};
	}

	public static string PageScanPeriodModeToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = P0");
		stringBuilder.AppendLine("0x1 = P1");
		stringBuilder.AppendLine("0x2 = P2");
		stringBuilder.AppendLine("0x3-0xFF = Reserved");
		return stringBuilder.ToString();
	}
}
