using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class WriteDefaultLinkPolicySettingsInfo : PacketInfoBase
{
	public override string Name => "Write Default Link Policy Settings";

	public override string DisplayGroup => "Link Policy";

	public WriteDefaultLinkPolicySettingsInfo(WriteDefaultLinkPolicySettings packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		WriteDefaultLinkPolicySettings writeDefaultLinkPolicySettings = (WriteDefaultLinkPolicySettings)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Link Policy Settings", LinkPolicySettingsInfo.LinkPolicySettingsToDescription(), 16, FormatValue(writeDefaultLinkPolicySettings.UserFields.LinkPolicySettings, 16), LinkPolicySettingsInfo.LinkPolicySettingsToString(LinkPolicySettingsInfo.ValueToLinkPolicySettings(writeDefaultLinkPolicySettings.UserFields.LinkPolicySettings)), "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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