using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class InitiatingFilterPolicyInfo
{
	public static InitiatingFilterPolicyEnum ValueToInitiatingFilterPolicy(uint value)
	{
		switch (value)
		{
		case 0u:
			return InitiatingFilterPolicyEnum.White_list_is_not_used_to_determine_which_advertiser_to_connect_Peer_Address_Type_and_Peer_Address_shall_be_used;
		case 1u:
			return InitiatingFilterPolicyEnum.White_list_is_used_to_determine_which_advertiser_to_connect_Peer_Address_Type_and_Peer_Address_shall_be_ignored;
		default:
			if (value >= 2 && value <= 255)
			{
				return InitiatingFilterPolicyEnum.RESERVED_FOR_FUTURE_USE;
			}
			return InitiatingFilterPolicyEnum.InvalidInitiatingFilterPolicyValue;
		}
	}

	public static uint InitiatingFilterPolicyToValue(InitiatingFilterPolicyEnum enumItem)
	{
		return enumItem switch
		{
			InitiatingFilterPolicyEnum.White_list_is_not_used_to_determine_which_advertiser_to_connect_Peer_Address_Type_and_Peer_Address_shall_be_used => 0u, 
			InitiatingFilterPolicyEnum.White_list_is_used_to_determine_which_advertiser_to_connect_Peer_Address_Type_and_Peer_Address_shall_be_ignored => 1u, 
			InitiatingFilterPolicyEnum.RESERVED_FOR_FUTURE_USE => 2u, 
			_ => uint.MaxValue, 
		};
	}

	public static string InitiatingFilterPolicyToString(InitiatingFilterPolicyEnum enumItem)
	{
		return enumItem switch
		{
			InitiatingFilterPolicyEnum.White_list_is_not_used_to_determine_which_advertiser_to_connect_Peer_Address_Type_and_Peer_Address_shall_be_used => "White list is not enabled.", 
			InitiatingFilterPolicyEnum.White_list_is_used_to_determine_which_advertiser_to_connect_Peer_Address_Type_and_Peer_Address_shall_be_ignored => "White list enabled.", 
			InitiatingFilterPolicyEnum.RESERVED_FOR_FUTURE_USE => "Reserved for future use", 
			_ => "Invalid InitiatingFilterPolicy Value", 
		};
	}

	public static string InitiatingFilterPolicyToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("0x0 = White list is not enabled.");
		stringBuilder.AppendLine("0x1 = White list enabled.");
		stringBuilder.AppendLine("0x2-0xFF = Reserved for future use");
		return stringBuilder.ToString();
	}
}
