using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class NumberOfReportsInfo
{
	public static NumberOfReportsEnum ValueToNumberOfReports(uint value)
	{
		if (value == 0)
		{
			return NumberOfReportsEnum.Reserved_for_future_use;
		}
		if (value >= 1 && value <= 25)
		{
			return NumberOfReportsEnum.Number_of_responses_in_event;
		}
		if (value >= 26 && value <= 255)
		{
			return NumberOfReportsEnum.Reserved_for_future_use;
		}
		return NumberOfReportsEnum.InvalidNumberOfReportsValue;
	}

	public static uint NumberOfReportsToValue(NumberOfReportsEnum enumItem)
	{
		switch (enumItem)
		{
		case NumberOfReportsEnum.Reserved_for_future_use:
			return 0u;
		case NumberOfReportsEnum.Number_of_responses_in_event:
			return 1u;
		default:
			if (enumItem == NumberOfReportsEnum.Reserved_for_future_use)
			{
				return 26u;
			}
			return uint.MaxValue;
		}
	}

	public static string NumberOfReportsToString(NumberOfReportsEnum enumItem)
	{
		switch (enumItem)
		{
		case NumberOfReportsEnum.Reserved_for_future_use:
			return "Reserved for future use";
		case NumberOfReportsEnum.Number_of_responses_in_event:
			return "Number of responses in event.";
		default:
			if (enumItem == NumberOfReportsEnum.Reserved_for_future_use)
			{
				return "Reserved for future use";
			}
			return "Invalid NumberOfReports Value";
		}
	}

	public static string NumberOfReportsToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = Reserved for future use");
		stringBuilder.AppendLine("0x1-0x19 = Number of responses in event.");
		stringBuilder.AppendLine("0x1A-0xFF = Reserved for future use");
		return stringBuilder.ToString();
	}
}
