using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class WriteSecureConnectionsTestModeInfo : PacketInfoBase
{
	public override string Name => "Write Secure Connections Test Mode";

	public override string DisplayGroup => "Testing";

	public WriteSecureConnectionsTestModeInfo(WriteSecureConnectionsTestMode packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		WriteSecureConnectionsTestMode writeSecureConnectionsTestMode = (WriteSecureConnectionsTestMode)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Connection_Handle", "Connection_Handle for which the test modes have been enabled/disabled. Range: 0x0000-0x0EFF. Reserved for future use (0x0F00 - 0x0FFF)", 16, FormatValue(writeSecureConnectionsTestMode.UserFields.ConnectionHandle, 16), "", "0000", "0EFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DM1_ACL_U_Mode", WriteSecureConnectionsTestMode.UserFieldsWrapper.Dm1AclUModeInfo.Dm1AclUModeToDescription(), 8, FormatValue(writeSecureConnectionsTestMode.UserFields.Dm1AclUMode, 8), WriteSecureConnectionsTestMode.UserFieldsWrapper.Dm1AclUModeInfo.Dm1AclUModeToString(WriteSecureConnectionsTestMode.UserFieldsWrapper.Dm1AclUModeInfo.ValueToDm1AclUMode(writeSecureConnectionsTestMode.UserFields.Dm1AclUMode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("eSCO_Loopback_Mode", WriteSecureConnectionsTestMode.UserFieldsWrapper.EscoLoopbackModeInfo.EscoLoopbackModeToDescription(), 8, FormatValue(writeSecureConnectionsTestMode.UserFields.EscoLoopbackMode, 8), WriteSecureConnectionsTestMode.UserFieldsWrapper.EscoLoopbackModeInfo.EscoLoopbackModeToString(WriteSecureConnectionsTestMode.UserFieldsWrapper.EscoLoopbackModeInfo.ValueToEscoLoopbackMode(writeSecureConnectionsTestMode.UserFields.EscoLoopbackMode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		WriteSecureConnectionsTestMode writeSecureConnectionsTestMode = (WriteSecureConnectionsTestMode)packet;
		int num = -1;
		if (index == ++num)
		{
			writeSecureConnectionsTestMode.UserFields.ConnectionHandle = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			writeSecureConnectionsTestMode.UserFields.Dm1AclUMode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			writeSecureConnectionsTestMode.UserFields.EscoLoopbackMode = Convert.ToUInt32(value, 16);
		}
	}
}
