using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class ChannelSelectedInfo : PacketInfoBase
{
	public override string Name => "Channel Selected";

	public override string DisplayGroup => "Link Control";

	public ChannelSelectedInfo(ChannelSelected packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		ChannelSelected channelSelected = (ChannelSelected)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Physical_Link_Handle", "Physical_Link_Handle to the established physical link.", 8, FormatValue(channelSelected.UserFields.PhysicalLinkHandle, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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