using System.Text;

namespace QCRPG.TSL.BT.Packets;

public static class SuspendHoldModeActivityInfo
{
	public static SuspendHoldModeActivityEnumCollection ValueToSuspendHoldModeActivity(uint value)
	{
		SuspendHoldModeActivityEnumCollection suspendHoldModeActivityEnumCollection = new SuspendHoldModeActivityEnumCollection();
		suspendHoldModeActivityEnumCollection.SuspendPageScan = EnableBitInfo.ValueToEnableBit(value & 1u);
		suspendHoldModeActivityEnumCollection.SuspendInquiryScan = EnableBitInfo.ValueToEnableBit((value & 2) >> 1);
		suspendHoldModeActivityEnumCollection.SuspendPeriodicInquiries = EnableBitInfo.ValueToEnableBit((value & 4) >> 2);
		return suspendHoldModeActivityEnumCollection;
	}

	public static uint SuspendHoldModeActivityToValue(SuspendHoldModeActivityEnumCollection enumCollection)
	{
		uint num = 0u;
		num |= EnableBitInfo.EnableBitToValue(enumCollection.SuspendPageScan);
		num |= EnableBitInfo.EnableBitToValue(enumCollection.SuspendInquiryScan) << 1;
		return num | (EnableBitInfo.EnableBitToValue(enumCollection.SuspendPeriodicInquiries) << 2);
	}

	public static string SuspendHoldModeActivityToString(SuspendHoldModeActivityEnumCollection enumCollection)
	{
		string text = "";
		text = text + "Suspend Page Scan: " + EnableBitInfo.EnableBitToString(enumCollection.SuspendPageScan) + "\r\n";
		text = text + "Suspend Inquiry Scan: " + EnableBitInfo.EnableBitToString(enumCollection.SuspendInquiryScan) + "\r\n";
		text = text + "Suspend Periodic Inquiries: " + EnableBitInfo.EnableBitToString(enumCollection.SuspendPeriodicInquiries) + "\r\n";
		return text.TrimEnd('\r', '\n');
	}

	public static string SuspendHoldModeActivityToDescription()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("Bit 0: Suspend Page Scan");
		stringBuilder.AppendLine("Bit 1: Suspend Inquiry Scan");
		stringBuilder.AppendLine("Bit 2: Suspend Periodic Inquiries");
		stringBuilder.AppendLine("Bits 15-3: Reserved for future use");
		return stringBuilder.ToString();
	}
}
