using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class DbfwSetScoDataDumpModeInfo : PacketInfoBase
{
	public override string Name => "Dbfw Set Sco Data Dump Mode";

	public override string DisplayGroup => "Vendor Specific";

	public DbfwSetScoDataDumpModeInfo(DbfwSetScoDataDumpMode packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		DbfwSetScoDataDumpMode dbfwSetScoDataDumpMode = (DbfwSetScoDataDumpMode)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub_OpCode", "", 8, FormatValue(dbfwSetScoDataDumpMode.UserFields.SubOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Dump_Mode", DbfwSetScoDataDumpMode.UserFieldsWrapper.DumpModeInfo.DumpModeToDescription(), 8, FormatValue(dbfwSetScoDataDumpMode.UserFields.DumpMode, 8), DbfwSetScoDataDumpMode.UserFieldsWrapper.DumpModeInfo.DumpModeToString(DbfwSetScoDataDumpMode.UserFieldsWrapper.DumpModeInfo.ValueToDumpMode(dbfwSetScoDataDumpMode.UserFields.DumpMode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Dump_Recording_Duration", "", 16, FormatValue(dbfwSetScoDataDumpMode.UserFields.DumpRecordingDuration, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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