using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class DebugConfigureCxmLogInfo : PacketInfoBase
{
	public override string Name => "Debug Configure Cxm Log";

	public override string DisplayGroup => "Vendor Specific";

	public DebugConfigureCxmLogInfo(DebugConfigureCxmLog packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		DebugConfigureCxmLog debugConfigureCxmLog = (DebugConfigureCxmLog)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub OpCode", "HCI_VS_DEBUG_CXM_LOG_CMD", 8, FormatValue(debugConfigureCxmLog.UserFields.SubOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Enable_MCI_CxM_Event", DebugConfigureCxmLog.UserFieldsWrapper.EnableMciCxmEventInfo.EnableMciCxmEventToDescription(), 8, FormatValue(debugConfigureCxmLog.UserFields.EnableMciCxmEvent, 8), DebugConfigureCxmLog.UserFieldsWrapper.EnableMciCxmEventInfo.EnableMciCxmEventToString(DebugConfigureCxmLog.UserFieldsWrapper.EnableMciCxmEventInfo.ValueToEnableMciCxmEvent(debugConfigureCxmLog.UserFields.EnableMciCxmEvent)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Force_Awake_Remote_Sleep_State", DebugConfigureCxmLog.UserFieldsWrapper.ForceAwakeRemoteSleepStateInfo.ForceAwakeRemoteSleepStateToDescription(), 8, FormatValue(debugConfigureCxmLog.UserFields.ForceAwakeRemoteSleepState, 8), DebugConfigureCxmLog.UserFieldsWrapper.ForceAwakeRemoteSleepStateInfo.ForceAwakeRemoteSleepStateToString(DebugConfigureCxmLog.UserFieldsWrapper.ForceAwakeRemoteSleepStateInfo.ValueToForceAwakeRemoteSleepState(debugConfigureCxmLog.UserFields.ForceAwakeRemoteSleepState)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Enable_MWS_CxM_Event", DebugConfigureCxmLog.UserFieldsWrapper.EnableMwsCxmEventInfo.EnableMwsCxmEventToDescription(), 8, FormatValue(debugConfigureCxmLog.UserFields.EnableMwsCxmEvent, 8), DebugConfigureCxmLog.UserFieldsWrapper.EnableMwsCxmEventInfo.EnableMwsCxmEventToString(DebugConfigureCxmLog.UserFieldsWrapper.EnableMwsCxmEventInfo.ValueToEnableMwsCxmEvent(debugConfigureCxmLog.UserFields.EnableMwsCxmEvent)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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