using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class PinCodeRequestInfo : PacketInfoBase
{
	public override string Name => "Pin Code Request";

	public override string DisplayGroup => "Link Control";

	public PinCodeRequestInfo(PinCodeRequest packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		PinCodeRequest pinCodeRequest = (PinCodeRequest)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("BD_ADDR", "BD_ADDR of the Device which a new link key is being created for.", 48, FormatValue(pinCodeRequest.UserFields.BdAddr, 48), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		PinCodeRequest pinCodeRequest = (PinCodeRequest)packet;
		int num = -1;
		if (index == ++num)
		{
			pinCodeRequest.UserFields.BdAddr = Convert.ToUInt64(value, 16);
		}
	}
}
