using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class FecRequiredInfo
{
	public static FecRequiredEnum ValueToFecRequired(uint value)
	{
		switch (value)
		{
		case 0u:
			return FecRequiredEnum.FEC_is_not_required;
		case 1u:
			return FecRequiredEnum.FEC_is_required;
		default:
			if (value >= 2 && value <= 255)
			{
				return FecRequiredEnum.RESERVED;
			}
			return FecRequiredEnum.InvalidFecRequiredValue;
		}
	}

	public static uint FecRequiredToValue(FecRequiredEnum enumItem)
	{
		return enumItem switch
		{
			FecRequiredEnum.FEC_is_not_required => 0u, 
			FecRequiredEnum.FEC_is_required => 1u, 
			FecRequiredEnum.RESERVED => 2u, 
			_ => uint.MaxValue, 
		};
	}

	public static string FecRequiredToString(FecRequiredEnum enumItem)
	{
		return enumItem switch
		{
			FecRequiredEnum.FEC_is_not_required => "FEC_is_not_required", 
			FecRequiredEnum.FEC_is_required => "FEC_is_required", 
			FecRequiredEnum.RESERVED => "Reserved", 
			_ => "Invalid FecRequired Value", 
		};
	}

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