using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class ProdTestStatsEventInfo : PacketInfoBase
{
	public override string Name => "Prod Test Stats Event";

	public override string DisplayGroup => "Vendor Specific";

	public ProdTestStatsEventInfo(ProdTestStatsEvent packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		ProdTestStatsEvent prodTestStatsEvent = (ProdTestStatsEvent)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Command", "", 8, FormatValue(prodTestStatsEvent.UserFields.Command, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Received Packets", "", 16, FormatValue(prodTestStatsEvent.UserFields.ReceivedPackets, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch1 Packets Received", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch1PacketsReceived, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch1 Packet Access Error Code", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch1PacketAccessErrorCode, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch1 HEC Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch1HecErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch1 CRC Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch1CrcErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch1 Total Packet Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch1TotalPacketBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch1 First Half Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch1FirstHalfBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch1 Last Half Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch1LastHalfBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch1 RSSI Reading", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch1RssiReading, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch2 Packets Received", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch2PacketsReceived, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch2 Packet Access Error Code", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch2PacketAccessErrorCode, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch2 HEC Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch2HecErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch2 CRC Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch2CrcErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch2 Total Packet Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch2TotalPacketBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch2 First Half Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch2FirstHalfBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch2 Last Half Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch2LastHalfBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch2 RSSI Reading", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch2RssiReading, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch3 Packets Received", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch3PacketsReceived, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch3 Packet Access Error Code", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch3PacketAccessErrorCode, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch3 HEC Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch3HecErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch3 CRC Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch3CrcErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch3 Total Packet Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch3TotalPacketBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch3 First Half Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch3FirstHalfBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch3 Last Half Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch3LastHalfBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch3 RSSI Reading", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch3RssiReading, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch4 Packets Received", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch4PacketsReceived, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch4 Packet Access Error Code", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch4PacketAccessErrorCode, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch4 HEC Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch4HecErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch4 CRC Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch4CrcErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch4 Total Packet Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch4TotalPacketBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch4 First Half Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch4FirstHalfBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch4 Last Half Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch4LastHalfBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch4 RSSI Reading", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch4RssiReading, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch5 Packets Received", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch5PacketsReceived, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch5 Packet Access Error Code", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch5PacketAccessErrorCode, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch5 HEC Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch5HecErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch5 CRC Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch5CrcErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch5 Total Packet Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch5TotalPacketBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch5 First Half Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch5FirstHalfBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch5 Last Half Bit Errors", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch5LastHalfBitErrors, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Ch5 RSSI Reading", "", 32, FormatValue(prodTestStatsEvent.UserFields.Ch5RssiReading, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		ProdTestStatsEvent prodTestStatsEvent = (ProdTestStatsEvent)packet;
		int num = -1;
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field Command");
		}
		if (index == ++num)
		{
			prodTestStatsEvent.UserFields.ReceivedPackets = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch1PacketsReceived = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch1PacketAccessErrorCode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch1HecErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch1CrcErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch1TotalPacketBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch1FirstHalfBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch1LastHalfBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch1RssiReading = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch2PacketsReceived = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch2PacketAccessErrorCode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch2HecErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch2CrcErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch2TotalPacketBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch2FirstHalfBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch2LastHalfBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch2RssiReading = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch3PacketsReceived = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch3PacketAccessErrorCode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch3HecErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch3CrcErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch3TotalPacketBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch3FirstHalfBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch3LastHalfBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch3RssiReading = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch4PacketsReceived = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch4PacketAccessErrorCode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch4HecErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch4CrcErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch4TotalPacketBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch4FirstHalfBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch4LastHalfBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch4RssiReading = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch5PacketsReceived = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch5PacketAccessErrorCode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch5HecErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch5CrcErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch5TotalPacketBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch5FirstHalfBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch5LastHalfBitErrors = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			prodTestStatsEvent.UserFields.Ch5RssiReading = Convert.ToUInt32(value, 16);
		}
	}
}
