using System.Text;

namespace QCRPG.TSL.NFC.Packets;

public static class NfceeIdsInfo
{
	public static NfceeIdsEnum ValueToNfceeIds(uint value)
	{
		if (value == 0)
		{
			return NfceeIdsEnum.DH_NFCEE_ID;
		}
		if (value >= 1 && value <= 254)
		{
			return NfceeIdsEnum.DYNAMIC;
		}
		if (value == 255)
		{
			return NfceeIdsEnum.RFU;
		}
		return NfceeIdsEnum.InvalidNfceeIdsValue;
	}

	public static uint NfceeIdsToValue(NfceeIdsEnum enumItem)
	{
		return enumItem switch
		{
			NfceeIdsEnum.DH_NFCEE_ID => 0u, 
			NfceeIdsEnum.DYNAMIC => 1u, 
			NfceeIdsEnum.RFU => 255u, 
			_ => uint.MaxValue, 
		};
	}

	public static string NfceeIdsToString(NfceeIdsEnum enumItem)
	{
		return enumItem switch
		{
			NfceeIdsEnum.DH_NFCEE_ID => "A static ID respresenting the DH-NFCEE.", 
			NfceeIdsEnum.DYNAMIC => "Dyanmically assigned by the NFCC.", 
			NfceeIdsEnum.RFU => "RFU", 
			_ => "Invalid NfceeIds Value", 
		};
	}

	public static string NfceeIdsToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = A static ID respresenting the DH-NFCEE.");
		stringBuilder.AppendLine("0x1-0xFE = Dyanmically assigned by the NFCC.");
		stringBuilder.AppendLine("0xFF = RFU");
		return stringBuilder.ToString();
	}
}
