using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class PhyPreferenceUseInfo
{
	public static PhyPreferenceUseEnumCollection ValueToPhyPreferenceUse(uint value)
	{
		PhyPreferenceUseEnumCollection phyPreferenceUseEnumCollection = new PhyPreferenceUseEnumCollection();
		phyPreferenceUseEnumCollection.TransmitterPreferenceUse = PhyPreferenceUseEnumCollection.TransmitterPreferenceUseInfo.ValueToTransmitterPreferenceUse(value & 1u);
		phyPreferenceUseEnumCollection.ReceiverPreferenceUse = PhyPreferenceUseEnumCollection.ReceiverPreferenceUseInfo.ValueToReceiverPreferenceUse((value & 2) >> 1);
		return phyPreferenceUseEnumCollection;
	}

	public static uint PhyPreferenceUseToValue(PhyPreferenceUseEnumCollection enumCollection)
	{
		uint num = 0u;
		num |= PhyPreferenceUseEnumCollection.TransmitterPreferenceUseInfo.TransmitterPreferenceUseToValue(enumCollection.TransmitterPreferenceUse);
		return num | (PhyPreferenceUseEnumCollection.ReceiverPreferenceUseInfo.ReceiverPreferenceUseToValue(enumCollection.ReceiverPreferenceUse) << 1);
	}

	public static string PhyPreferenceUseToString(PhyPreferenceUseEnumCollection enumCollection)
	{
		string text = "";
		text = text + "Transmitter Preference Use: " + PhyPreferenceUseEnumCollection.TransmitterPreferenceUseInfo.TransmitterPreferenceUseToString(enumCollection.TransmitterPreferenceUse) + "\r\n";
		text = text + "Receiver Preference Use: " + PhyPreferenceUseEnumCollection.ReceiverPreferenceUseInfo.ReceiverPreferenceUseToString(enumCollection.ReceiverPreferenceUse) + "\r\n";
		return text.TrimEnd('\r', '\n');
	}

	public static string PhyPreferenceUseToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("Bit 0: Transmitter Preference Use");
		stringBuilder.AppendLine(PhyPreferenceUseEnumCollection.TransmitterPreferenceUseInfo.TransmitterPreferenceUseToDescription());
		stringBuilder.AppendLine("Bit 1: Receiver Preference Use");
		stringBuilder.AppendLine(PhyPreferenceUseEnumCollection.ReceiverPreferenceUseInfo.ReceiverPreferenceUseToDescription());
		stringBuilder.AppendLine("Bits 7-2: Reserved for future use");
		return stringBuilder.ToString();
	}
}
