using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class ReadLinkPolicySettingsInfo : PacketInfoBase
{
	public override string Name => "Read Link Policy Settings";

	public override string DisplayGroup => "Link Policy";

	public ReadLinkPolicySettingsInfo(ReadLinkPolicySettings packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		ReadLinkPolicySettings readLinkPolicySettings = (ReadLinkPolicySettings)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Connection Handle", "Connection_Handle for which the Link Key has been changed for all devices in the same piconet.", 16, FormatValue(readLinkPolicySettings.UserFields.ConnectionHandle, 16), "", "", "0EFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		ReadLinkPolicySettings readLinkPolicySettings = (ReadLinkPolicySettings)packet;
		int num = -1;
		if (index == ++num)
		{
			readLinkPolicySettings.UserFields.ConnectionHandle = Convert.ToUInt32(value, 16);
		}
	}
}
