using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LtMep23TestModeInfo : PacketInfoBase
{
	public override string Name => "Lt Mep23 Test Mode";

	public override string DisplayGroup => "Vendor Specific";

	public LtMep23TestModeInfo(LtMep23TestMode packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LtMep23TestMode ltMep23TestMode = (LtMep23TestMode)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub OpCode", "Used for MEP23 test", 8, FormatValue(ltMep23TestMode.UserFields.SubOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Mode", LtMep23TestMode.UserFieldsWrapper.ModeInfo.ModeToDescription(), 8, FormatValue(ltMep23TestMode.UserFields.Mode, 8), LtMep23TestMode.UserFieldsWrapper.ModeInfo.ModeToString(LtMep23TestMode.UserFieldsWrapper.ModeInfo.ValueToMode(ltMep23TestMode.UserFields.Mode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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