using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class CountryCodeInfo
{
	public static CountryCodeEnum ValueToCountryCode(uint value)
	{
		if (value == 0)
		{
			return CountryCodeEnum.NorthAmerica_Europe_Japan;
		}
		if (value == 1)
		{
			return CountryCodeEnum.France;
		}
		if (value >= 4 && value <= 255)
		{
			return CountryCodeEnum.RESERVED;
		}
		return CountryCodeEnum.InvalidCountryCodeValue;
	}

	public static uint CountryCodeToValue(CountryCodeEnum enumItem)
	{
		return enumItem switch
		{
			CountryCodeEnum.NorthAmerica_Europe_Japan => 0u, 
			CountryCodeEnum.France => 1u, 
			CountryCodeEnum.RESERVED => 4u, 
			_ => uint.MaxValue, 
		};
	}

	public static string CountryCodeToString(CountryCodeEnum enumItem)
	{
		return enumItem switch
		{
			CountryCodeEnum.NorthAmerica_Europe_Japan => "NorthAmerica_Europe_Japan", 
			CountryCodeEnum.France => "France", 
			CountryCodeEnum.RESERVED => "Reserved", 
			_ => "Invalid CountryCode Value", 
		};
	}

	public static string CountryCodeToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = NorthAmerica_Europe_Japan");
		stringBuilder.AppendLine("0x1 = France");
		stringBuilder.AppendLine("0x4-0xFF = Reserved");
		return stringBuilder.ToString();
	}
}
