using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class SlotTypeInfo
{
	public static SlotTypeEnum ValueToSlotType(uint value)
	{
		switch (value)
		{
		case 0u:
			return SlotTypeEnum.No_Supplemental;
		case 1u:
			return SlotTypeEnum.Supplemental_1_us_SLOTS;
		case 2u:
			return SlotTypeEnum.Supplemental_2_us_SLOTS;
		default:
			if (value >= 3 && value <= 255)
			{
				return SlotTypeEnum.Reserved_for_future_use;
			}
			return SlotTypeEnum.InvalidSlotTypeValue;
		}
	}

	public static uint SlotTypeToValue(SlotTypeEnum enumItem)
	{
		return enumItem switch
		{
			SlotTypeEnum.No_Supplemental => 0u, 
			SlotTypeEnum.Supplemental_1_us_SLOTS => 1u, 
			SlotTypeEnum.Supplemental_2_us_SLOTS => 2u, 
			SlotTypeEnum.Reserved_for_future_use => 3u, 
			_ => uint.MaxValue, 
		};
	}

	public static string SlotTypeToString(SlotTypeEnum enumItem)
	{
		return enumItem switch
		{
			SlotTypeEnum.No_Supplemental => "No_Supplemental", 
			SlotTypeEnum.Supplemental_1_us_SLOTS => "Supplemental_1_us_SLOTS", 
			SlotTypeEnum.Supplemental_2_us_SLOTS => "Supplemental_2_us_SLOTS", 
			SlotTypeEnum.Reserved_for_future_use => "Reserved for future use", 
			_ => "Invalid SlotType Value", 
		};
	}

	public static string SlotTypeToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = No_Supplemental");
		stringBuilder.AppendLine("0x1 = Supplemental_1_us_SLOTS");
		stringBuilder.AppendLine("0x2 = Supplemental_2_us_SLOTS");
		stringBuilder.AppendLine("0x3-0xFF = Reserved for future use");
		return stringBuilder.ToString();
	}
}
