using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LtLePingTestInfo : PacketInfoBase
{
	public override string Name => "Lt Le Ping Test";

	public override string DisplayGroup => "Vendor Specific";

	public LtLePingTestInfo(LtLePingTest packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LtLePingTest ltLePingTest = (LtLePingTest)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub OpCode", "Set LE Ping test modes/parameters", 8, FormatValue(ltLePingTest.UserFields.SubOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("PING_Test_Mode", LtLePingTest.UserFieldsWrapper.PingTestModeInfo.PingTestModeToDescription(), 8, FormatValue(ltLePingTest.UserFields.PingTestMode, 8), LtLePingTest.UserFieldsWrapper.PingTestModeInfo.PingTestModeToString(LtLePingTest.UserFieldsWrapper.PingTestModeInfo.ValueToPingTestMode(ltLePingTest.UserFields.PingTestMode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LtLePingTest ltLePingTest = (LtLePingTest)packet;
		int num = -1;
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field SubOpcode");
		}
		if (index == ++num)
		{
			ltLePingTest.UserFields.PingTestMode = Convert.ToUInt32(value, 16);
		}
	}
}
