using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LtAoxTestModeInfo : PacketInfoBase
{
	public override string Name => "Lt Aox Test Mode";

	public override string DisplayGroup => "Vendor Specific";

	public LtAoxTestModeInfo(LtAoxTestMode packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LtAoxTestMode ltAoxTestMode = (LtAoxTestMode)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub OpCode", "", 8, FormatValue(ltAoxTestMode.UserFields.SubOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Enable", LtAoxTestMode.UserFieldsWrapper.EnableInfo.EnableToDescription(), 8, FormatValue(ltAoxTestMode.UserFields.Enable, 8), LtAoxTestMode.UserFieldsWrapper.EnableInfo.EnableToString(LtAoxTestMode.UserFieldsWrapper.EnableInfo.ValueToEnable(ltAoxTestMode.UserFields.Enable)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("AoX_Test_Mode", LtAoxTestMode.UserFieldsWrapper.AoxTestModeInfo.AoxTestModeToDescription(), 8, FormatValue(ltAoxTestMode.UserFields.AoxTestMode, 8), LtAoxTestMode.UserFieldsWrapper.AoxTestModeInfo.AoxTestModeToString(LtAoxTestMode.UserFieldsWrapper.AoxTestModeInfo.ValueToAoxTestMode(ltAoxTestMode.UserFields.AoxTestMode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Supplemental_Type", AodSupplementalTypeInfo.AodSupplementalTypeToDescription(), 8, FormatValue(ltAoxTestMode.UserFields.SupplementalType, 8), AodSupplementalTypeInfo.AodSupplementalTypeToString(AodSupplementalTypeInfo.ValueToAodSupplementalType(ltAoxTestMode.UserFields.SupplementalType)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Supplemental_Length", LtAoxTestMode.UserFieldsWrapper.SupplementalLengthInfo.SupplementalLengthToDescription(), 8, FormatValue(ltAoxTestMode.UserFields.SupplementalLength, 8), LtAoxTestMode.UserFieldsWrapper.SupplementalLengthInfo.SupplementalLengthToString(LtAoxTestMode.UserFieldsWrapper.SupplementalLengthInfo.ValueToSupplementalLength(ltAoxTestMode.UserFields.SupplementalLength)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LtAoxTestMode ltAoxTestMode = (LtAoxTestMode)packet;
		int num = -1;
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field SubOpcode");
		}
		if (index == ++num)
		{
			ltAoxTestMode.UserFields.Enable = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			ltAoxTestMode.UserFields.AoxTestMode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			ltAoxTestMode.UserFields.SupplementalType = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			ltAoxTestMode.UserFields.SupplementalLength = Convert.ToUInt32(value, 16);
		}
	}
}
