using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class PageScanTypeInfo
{
	public static PageScanTypeEnum ValueToPageScanType(uint value)
	{
		switch (value)
		{
		case 0u:
			return PageScanTypeEnum.Mandatory_Standard_Scan;
		case 1u:
			return PageScanTypeEnum.Optional_Interlaced_Scan;
		default:
			if (value >= 2 && value <= 255)
			{
				return PageScanTypeEnum.RESERVED;
			}
			return PageScanTypeEnum.InvalidPageScanTypeValue;
		}
	}

	public static uint PageScanTypeToValue(PageScanTypeEnum enumItem)
	{
		return enumItem switch
		{
			PageScanTypeEnum.Mandatory_Standard_Scan => 0u, 
			PageScanTypeEnum.Optional_Interlaced_Scan => 1u, 
			PageScanTypeEnum.RESERVED => 2u, 
			_ => uint.MaxValue, 
		};
	}

	public static string PageScanTypeToString(PageScanTypeEnum enumItem)
	{
		return enumItem switch
		{
			PageScanTypeEnum.Mandatory_Standard_Scan => "Mandatory_Standard_Scan", 
			PageScanTypeEnum.Optional_Interlaced_Scan => "Optional_Interlaced_Scan", 
			PageScanTypeEnum.RESERVED => "Reserved", 
			_ => "Invalid PageScanType Value", 
		};
	}

	public static string PageScanTypeToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = Mandatory_Standard_Scan");
		stringBuilder.AppendLine("0x1 = Optional_Interlaced_Scan");
		stringBuilder.AppendLine("0x2-0xFF = Reserved");
		return stringBuilder.ToString();
	}
}
