using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class OtaQlmpNotAcceptedPduInfo : PacketInfoBase
{
	public override string Name => "Ota Qlmp Not Accepted Pdu";

	public override string DisplayGroup => "Enhanced Logging";

	public OtaQlmpNotAcceptedPduInfo(OtaQlmpNotAcceptedPdu packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		OtaQlmpNotAcceptedPdu otaQlmpNotAcceptedPdu = (OtaQlmpNotAcceptedPdu)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Seq_Num", "", 8, FormatValue(otaQlmpNotAcceptedPdu.UserFields.SeqNum, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Logs_Lost_Drop", "", 8, FormatValue(otaQlmpNotAcceptedPdu.UserFields.LogsLostDrop, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Prod_ID", "", 8, FormatValue(otaQlmpNotAcceptedPdu.UserFields.ProdId, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Log_Id", OtaQlmpNotAcceptedPdu.UserFieldsWrapper.LogIdInfo.LogIdToDescription(), 16, FormatValue(otaQlmpNotAcceptedPdu.UserFields.LogId, 16), OtaQlmpNotAcceptedPdu.UserFieldsWrapper.LogIdInfo.LogIdToString(OtaQlmpNotAcceptedPdu.UserFieldsWrapper.LogIdInfo.ValueToLogId(otaQlmpNotAcceptedPdu.UserFields.LogId)), "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Log_Format_Level", "", 8, FormatValue(otaQlmpNotAcceptedPdu.UserFields.LogFormatLevel, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Timestamp", "", 32, FormatValue(otaQlmpNotAcceptedPdu.UserFields.Timestamp, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("QLMP_Opcode", "", 8, FormatValue(otaQlmpNotAcceptedPdu.UserFields.QlmpOpcode, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		OtaQlmpNotAcceptedPdu otaQlmpNotAcceptedPdu = (OtaQlmpNotAcceptedPdu)packet;
		int num = -1;
		if (index == ++num)
		{
			otaQlmpNotAcceptedPdu.UserFields.SeqNum = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			otaQlmpNotAcceptedPdu.UserFields.LogsLostDrop = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			otaQlmpNotAcceptedPdu.UserFields.ProdId = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			otaQlmpNotAcceptedPdu.UserFields.LogId = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			otaQlmpNotAcceptedPdu.UserFields.LogFormatLevel = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			otaQlmpNotAcceptedPdu.UserFields.Timestamp = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			otaQlmpNotAcceptedPdu.UserFields.QlmpOpcode = Convert.ToUInt32(value, 16);
		}
	}
}
