using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LtQ2qTestInfo : PacketInfoBase
{
	public override string Name => "Lt Q2q Test";

	public override string DisplayGroup => "Vendor Specific";

	public LtQ2qTestInfo(LtQ2qTest packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LtQ2qTest ltQ2qTest = (LtQ2qTest)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub OpCode", "Set Q2Q test modes, including QLL/QLMP", 8, FormatValue(ltQ2qTest.UserFields.SubOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Q2Q_Test_Mode", LtQ2qTest.UserFieldsWrapper.Q2qTestModeInfo.Q2qTestModeToDescription(), 8, FormatValue(ltQ2qTest.UserFields.Q2qTestMode, 8), LtQ2qTest.UserFieldsWrapper.Q2qTestModeInfo.Q2qTestModeToString(LtQ2qTest.UserFieldsWrapper.Q2qTestModeInfo.ValueToQ2qTestMode(ltQ2qTest.UserFields.Q2qTestMode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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