using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class SlcLogIdTxVerboseInfo : PacketInfoBase
{
	public override string Name => "Slc Log Id Tx Verbose";

	public override string DisplayGroup => "Enhanced Logging";

	public SlcLogIdTxVerboseInfo(SlcLogIdTxVerbose packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		SlcLogIdTxVerbose slcLogIdTxVerbose = (SlcLogIdTxVerbose)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Seq_Num", "", 8, FormatValue(slcLogIdTxVerbose.UserFields.SeqNum, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Logs_Lost_Drop", "", 8, FormatValue(slcLogIdTxVerbose.UserFields.LogsLostDrop, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Prod_ID", "", 8, FormatValue(slcLogIdTxVerbose.UserFields.ProdId, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Log_Id", SlcLogIdTxVerbose.UserFieldsWrapper.LogIdInfo.LogIdToDescription(), 16, FormatValue(slcLogIdTxVerbose.UserFields.LogId, 16), SlcLogIdTxVerbose.UserFieldsWrapper.LogIdInfo.LogIdToString(SlcLogIdTxVerbose.UserFieldsWrapper.LogIdInfo.ValueToLogId(slcLogIdTxVerbose.UserFields.LogId)), "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Log_Format_Level", "", 8, FormatValue(slcLogIdTxVerbose.UserFields.LogFormatLevel, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Timestamp", "", 32, FormatValue(slcLogIdTxVerbose.UserFields.Timestamp, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("SLC_Fmt_Specifier", "", 2, FormatValue(slcLogIdTxVerbose.UserFields.SlcFmtSpecifier, 2), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("SLC_Log_ID", SlcLogIdTxVerbose.UserFieldsWrapper.SlcLogIdInfo.SlcLogIdToDescription(), 6, FormatValue(slcLogIdTxVerbose.UserFields.SlcLogId, 6), SlcLogIdTxVerbose.UserFieldsWrapper.SlcLogIdInfo.SlcLogIdToString(SlcLogIdTxVerbose.UserFieldsWrapper.SlcLogIdInfo.ValueToSlcLogId(slcLogIdTxVerbose.UserFields.SlcLogId)), "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("LT_Address", "", 8, FormatValue(slcLogIdTxVerbose.UserFields.LtAddress, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Packet_Type", "", 8, FormatValue(slcLogIdTxVerbose.UserFields.PacketType, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("L2CapFlow", SlcLogIdTxVerbose.UserFieldsWrapper.L2capflowInfo.L2capflowToDescription(), 2, FormatValue(slcLogIdTxVerbose.UserFields.L2capflow, 2), SlcLogIdTxVerbose.UserFieldsWrapper.L2capflowInfo.L2capflowToString(SlcLogIdTxVerbose.UserFieldsWrapper.L2capflowInfo.ValueToL2capflow(slcLogIdTxVerbose.UserFields.L2capflow)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Late_Command", "", 1, FormatValue(slcLogIdTxVerbose.UserFields.LateCommand, 1), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Cxm_Denial", "", 1, FormatValue(slcLogIdTxVerbose.UserFields.CxmDenial, 1), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Cxm_Abort", "", 1, FormatValue(slcLogIdTxVerbose.UserFields.CxmAbort, 1), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Slc_Seq_Num", "", 1, FormatValue(slcLogIdTxVerbose.UserFields.SlcSeqNum, 1), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("ArqN", SlcLogIdTxVerbose.UserFieldsWrapper.ArqnInfo.ArqnToDescription(), 1, FormatValue(slcLogIdTxVerbose.UserFields.Arqn, 1), SlcLogIdTxVerbose.UserFieldsWrapper.ArqnInfo.ArqnToString(SlcLogIdTxVerbose.UserFieldsWrapper.ArqnInfo.ValueToArqn(slcLogIdTxVerbose.UserFields.Arqn)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Packet_Flow", SlcLogIdTxVerbose.UserFieldsWrapper.PacketFlowInfo.PacketFlowToDescription(), 1, FormatValue(slcLogIdTxVerbose.UserFields.PacketFlow, 1), SlcLogIdTxVerbose.UserFieldsWrapper.PacketFlowInfo.PacketFlowToString(SlcLogIdTxVerbose.UserFieldsWrapper.PacketFlowInfo.ValueToPacketFlow(slcLogIdTxVerbose.UserFields.PacketFlow)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		SlcLogIdTxVerbose slcLogIdTxVerbose = (SlcLogIdTxVerbose)packet;
		int num = -1;
		if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.SeqNum = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.LogsLostDrop = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.ProdId = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.LogId = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.LogFormatLevel = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.Timestamp = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.SlcFmtSpecifier = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field SlcLogId");
		}
		if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.LtAddress = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.PacketType = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.L2capflow = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.LateCommand = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.CxmDenial = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.CxmAbort = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.SlcSeqNum = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.Arqn = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdTxVerbose.UserFields.PacketFlow = Convert.ToUInt32(value, 16);
		}
	}
}
