using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

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

	public override string DisplayGroup => "Vendor Specific";

	public DbfwSetScoPacketInfoModeInfo(DbfwSetScoPacketInfoMode packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		DbfwSetScoPacketInfoMode dbfwSetScoPacketInfoMode = (DbfwSetScoPacketInfoMode)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub_OpCode", "", 8, FormatValue(dbfwSetScoPacketInfoMode.UserFields.SubOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Enable_Mode", "Disable or Enable\r\n\r\n" + DbfwSetScoPacketInfoMode.UserFieldsWrapper.EnableModeInfo.EnableModeToDescription(), 8, FormatValue(dbfwSetScoPacketInfoMode.UserFields.EnableMode, 8), DbfwSetScoPacketInfoMode.UserFieldsWrapper.EnableModeInfo.EnableModeToString(DbfwSetScoPacketInfoMode.UserFieldsWrapper.EnableModeInfo.ValueToEnableMode(dbfwSetScoPacketInfoMode.UserFields.EnableMode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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