using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class DbfwSetScoDebugInfoModeInfo : PacketInfoBase
{
	public override string Name => "Dbfw Set Sco Debug Info Mode";

	public override string DisplayGroup => "Vendor Specific";

	public DbfwSetScoDebugInfoModeInfo(DbfwSetScoDebugInfoMode packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		DbfwSetScoDebugInfoMode dbfwSetScoDebugInfoMode = (DbfwSetScoDebugInfoMode)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub_OpCode", "", 8, FormatValue(dbfwSetScoDebugInfoMode.UserFields.SubOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Enable_Mode", "Disable or Enable\r\n\r\n" + DbfwSetScoDebugInfoMode.UserFieldsWrapper.EnableModeInfo.EnableModeToDescription(), 8, FormatValue(dbfwSetScoDebugInfoMode.UserFields.EnableMode, 8), DbfwSetScoDebugInfoMode.UserFieldsWrapper.EnableModeInfo.EnableModeToString(DbfwSetScoDebugInfoMode.UserFieldsWrapper.EnableModeInfo.ValueToEnableMode(dbfwSetScoDebugInfoMode.UserFields.EnableMode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Count_Null_Packet_Mode", "Null packet needs to be counted as missed or not\r\n\r\n" + DbfwSetScoDebugInfoMode.UserFieldsWrapper.CountNullPacketModeInfo.CountNullPacketModeToDescription(), 8, FormatValue(dbfwSetScoDebugInfoMode.UserFields.CountNullPacketMode, 8), DbfwSetScoDebugInfoMode.UserFieldsWrapper.CountNullPacketModeInfo.CountNullPacketModeToString(DbfwSetScoDebugInfoMode.UserFieldsWrapper.CountNullPacketModeInfo.ValueToCountNullPacketMode(dbfwSetScoDebugInfoMode.UserFields.CountNullPacketMode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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