using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class GetPerInfo : PacketInfoBase
{
	public override string Name => "Get Per";

	public override string DisplayGroup => "Vendor Specific Legacy Atheros";

	public GetPerInfo(GetPer packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		GetPer getPer = (GetPer)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("PER Mode", Ar3002PacketTypeInfo.Ar3002PacketTypeToDescription(), 8, FormatValue(getPer.UserFields.PerMode, 8), Ar3002PacketTypeInfo.Ar3002PacketTypeToString(Ar3002PacketTypeInfo.ValueToAr3002PacketType(getPer.UserFields.PerMode)), "", "0D", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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