using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class QhsReceiverPhyPreferenceInfo
{
	public static QhsReceiverPhyPreferenceEnumCollection ValueToQhsReceiverPhyPreference(uint value)
	{
		QhsReceiverPhyPreferenceEnumCollection qhsReceiverPhyPreferenceEnumCollection = new QhsReceiverPhyPreferenceEnumCollection();
		qhsReceiverPhyPreferenceEnumCollection.QhsPRxPhyPreference = QhsPPhyPreferenceInfo.ValueToQhsPPhyPreference((value & 8) >> 3);
		qhsReceiverPhyPreferenceEnumCollection.QhsFRxPhyPreference = QhsFPhyPreferenceInfo.ValueToQhsFPhyPreference((value & 0x10) >> 4);
		return qhsReceiverPhyPreferenceEnumCollection;
	}

	public static uint QhsReceiverPhyPreferenceToValue(QhsReceiverPhyPreferenceEnumCollection enumCollection)
	{
		uint num = 0u;
		num |= QhsPPhyPreferenceInfo.QhsPPhyPreferenceToValue(enumCollection.QhsPRxPhyPreference) << 3;
		return num | (QhsFPhyPreferenceInfo.QhsFPhyPreferenceToValue(enumCollection.QhsFRxPhyPreference) << 4);
	}

	public static string QhsReceiverPhyPreferenceToString(QhsReceiverPhyPreferenceEnumCollection enumCollection)
	{
		string text = "";
		text = text + "QHS-P RX PHY Preference: " + QhsPPhyPreferenceInfo.QhsPPhyPreferenceToString(enumCollection.QhsPRxPhyPreference) + "\r\n";
		text = text + "QHS-F RX PHY Preference: " + QhsFPhyPreferenceInfo.QhsFPhyPreferenceToString(enumCollection.QhsFRxPhyPreference) + "\r\n";
		return text.TrimEnd('\r', '\n');
	}

	public static string QhsReceiverPhyPreferenceToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("Bit 3: QHS-P RX PHY Preference");
		stringBuilder.AppendLine(QhsPPhyPreferenceInfo.QhsPPhyPreferenceToDescription());
		stringBuilder.AppendLine("Bit 4: QHS-F RX PHY Preference");
		stringBuilder.AppendLine(QhsFPhyPreferenceInfo.QhsFPhyPreferenceToDescription());
		stringBuilder.AppendLine("Bits 7-5: Reserved for future use");
		return stringBuilder.ToString();
	}
}
