using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class GetMptaGrantModePriorityInfo : PacketInfoBase
{
	public override string Name => "Get Mpta Grant Mode Priority";

	public override string DisplayGroup => "Vendor Specific";

	public GetMptaGrantModePriorityInfo(GetMptaGrantModePriority packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		GetMptaGrantModePriority getMptaGrantModePriority = (GetMptaGrantModePriority)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub OpCode", GetMptaGrantModePriority.UserFieldsWrapper.SubOpcodeInfo.SubOpcodeToDescription(), 8, FormatValue(getMptaGrantModePriority.UserFields.SubOpcode, 8), GetMptaGrantModePriority.UserFieldsWrapper.SubOpcodeInfo.SubOpcodeToString(GetMptaGrantModePriority.UserFieldsWrapper.SubOpcodeInfo.ValueToSubOpcode(getMptaGrantModePriority.UserFields.SubOpcode)), "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("OP Type", GetMptaGrantModePriority.UserFieldsWrapper.OpTypeInfo.OpTypeToDescription(), 8, FormatValue(getMptaGrantModePriority.UserFields.OpType, 8), GetMptaGrantModePriority.UserFieldsWrapper.OpTypeInfo.OpTypeToString(GetMptaGrantModePriority.UserFieldsWrapper.OpTypeInfo.ValueToOpType(getMptaGrantModePriority.UserFields.OpType)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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