using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class SlcLogIdDispatchFutureInfo : PacketInfoBase
{
	public override string Name => "Slc Log Id Dispatch Future";

	public override string DisplayGroup => "Enhanced Logging";

	public SlcLogIdDispatchFutureInfo(SlcLogIdDispatchFuture packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		SlcLogIdDispatchFuture slcLogIdDispatchFuture = (SlcLogIdDispatchFuture)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Seq_Num", "", 8, FormatValue(slcLogIdDispatchFuture.UserFields.SeqNum, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Logs_Lost_Drop", "", 8, FormatValue(slcLogIdDispatchFuture.UserFields.LogsLostDrop, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Prod_ID", "", 8, FormatValue(slcLogIdDispatchFuture.UserFields.ProdId, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Log_Id", SlcLogIdDispatchFuture.UserFieldsWrapper.LogIdInfo.LogIdToDescription(), 16, FormatValue(slcLogIdDispatchFuture.UserFields.LogId, 16), SlcLogIdDispatchFuture.UserFieldsWrapper.LogIdInfo.LogIdToString(SlcLogIdDispatchFuture.UserFieldsWrapper.LogIdInfo.ValueToLogId(slcLogIdDispatchFuture.UserFields.LogId)), "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Log_Format_Level", "", 8, FormatValue(slcLogIdDispatchFuture.UserFields.LogFormatLevel, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Timestamp", "", 32, FormatValue(slcLogIdDispatchFuture.UserFields.Timestamp, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("SLC_Fmt_Specifier", "", 2, FormatValue(slcLogIdDispatchFuture.UserFields.SlcFmtSpecifier, 2), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("SLC_Log_ID", SlcLogIdDispatchFuture.UserFieldsWrapper.SlcLogIdInfo.SlcLogIdToDescription(), 6, FormatValue(slcLogIdDispatchFuture.UserFields.SlcLogId, 6), SlcLogIdDispatchFuture.UserFieldsWrapper.SlcLogIdInfo.SlcLogIdToString(SlcLogIdDispatchFuture.UserFieldsWrapper.SlcLogIdInfo.ValueToSlcLogId(slcLogIdDispatchFuture.UserFields.SlcLogId)), "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Opcode", SlcLogIdDispatchFuture.UserFieldsWrapper.OpcodeInfo.OpcodeToDescription(), 8, FormatValue(slcLogIdDispatchFuture.UserFields.Opcode, 8), SlcLogIdDispatchFuture.UserFieldsWrapper.OpcodeInfo.OpcodeToString(SlcLogIdDispatchFuture.UserFieldsWrapper.OpcodeInfo.ValueToOpcode(slcLogIdDispatchFuture.UserFields.Opcode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Priority", "", 8, FormatValue(slcLogIdDispatchFuture.UserFields.Priority, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Reserved", "", 8, FormatValue(slcLogIdDispatchFuture.UserFields.Reserved, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Blackout", "", 1, FormatValue(slcLogIdDispatchFuture.UserFields.Blackout, 1), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Slots", "", 4, FormatValue(slcLogIdDispatchFuture.UserFields.Slots, 4), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Piconet", "", 3, FormatValue(slcLogIdDispatchFuture.UserFields.Piconet, 3), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		SlcLogIdDispatchFuture slcLogIdDispatchFuture = (SlcLogIdDispatchFuture)packet;
		int num = -1;
		if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.SeqNum = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.LogsLostDrop = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.ProdId = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.LogId = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.LogFormatLevel = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.Timestamp = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.SlcFmtSpecifier = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field SlcLogId");
		}
		if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.Opcode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.Priority = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.Reserved = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.Blackout = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.Slots = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			slcLogIdDispatchFuture.UserFields.Piconet = Convert.ToUInt32(value, 16);
		}
	}
}
