using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class ReadFailedContactCounterInfo : PacketInfoBase
{
	public override string Name => "Read Failed Contact Counter";

	public override string DisplayGroup => "Status Parameters";

	public ReadFailedContactCounterInfo(ReadFailedContactCounter packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		ReadFailedContactCounter readFailedContactCounter = (ReadFailedContactCounter)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Handle", "The Handle for the Connection for which the Failed Contact Counter should be read. The Handle is a Connection_Handle for a BR/EDR Controller and a Logical_Link_Handle for an AMP Controller. Range: 0x0000-0x0EFF (0x0F00 - 0x0FFF Reserved for future use)", 16, FormatValue(readFailedContactCounter.UserFields.Handle, 16), "", "0000", "0EFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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