using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class QcaDebugLogEnableInfo : PacketInfoBase
{
	public override string Name => "Qca Debug Log Enable";

	public override string DisplayGroup => "Vendor Specific";

	public QcaDebugLogEnableInfo(QcaDebugLogEnable packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		QcaDebugLogEnable qcaDebugLogEnable = (QcaDebugLogEnable)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub OpCode", "HCI_VS_HOST_LOG_ENH_CONFIG_SUBID", 8, FormatValue(qcaDebugLogEnable.UserFields.SubOpcode, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("CFG Flags", "CFG Flags", 16, FormatValue(qcaDebugLogEnable.UserFields.CfgFlags, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Interval", "", 8, FormatValue(qcaDebugLogEnable.UserFields.Interval, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Log Level", "", 8, FormatValue(qcaDebugLogEnable.UserFields.LogLevel, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		QcaDebugLogEnable qcaDebugLogEnable = (QcaDebugLogEnable)packet;
		int num = -1;
		if (index == ++num)
		{
			qcaDebugLogEnable.UserFields.SubOpcode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			qcaDebugLogEnable.UserFields.CfgFlags = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			qcaDebugLogEnable.UserFields.Interval = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			qcaDebugLogEnable.UserFields.LogLevel = Convert.ToUInt32(value, 16);
		}
	}
}
