using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class AmpTestEndInfo : PacketInfoBase
{
	public override string Name => "Amp Test End";

	public override string DisplayGroup => "Testing";

	public AmpTestEndInfo(AmpTestEnd packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		AmpTestEnd ampTestEnd = (AmpTestEnd)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Status", ErrorCodeInfo.ErrorCodeToDescription(), 8, FormatValue(ampTestEnd.UserFields.Status, 8), ErrorCodeInfo.ErrorCodeToString(ErrorCodeInfo.ValueToErrorCode(ampTestEnd.UserFields.Status)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Test_Scenario", "See the Test Commands section of the Protocol Adaptation Layer Functional Specification for the Controller type.", 8, FormatValue(ampTestEnd.UserFields.TestScenario, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		AmpTestEnd ampTestEnd = (AmpTestEnd)packet;
		int num = -1;
		if (index == ++num)
		{
			ampTestEnd.UserFields.Status = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			ampTestEnd.UserFields.TestScenario = Convert.ToUInt32(value, 16);
		}
	}
}
