using System;
using QCRPG.Framework;

namespace QCRPG.TSL.NFC.Packets;

public class CoreConnCloseCmdInfo : PacketInfoBase
{
	public override string Name => "Core Conn Close Cmd";

	public override string DisplayGroup => "NCI Core";

	public CoreConnCloseCmdInfo(CoreConnCloseCmd packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		CoreConnCloseCmd coreConnCloseCmd = (CoreConnCloseCmd)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Conn ID", "The identifier of the connection to be closed.  The four least significant bits of the octet SHALL contain the Conn ID as defined in Table 4. The four most significant bits are RFU.", 8, FormatValue(coreConnCloseCmd.UserFields.ConnId, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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