using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class HeadlessModeEnableInfo : PacketInfoBase
{
	public override string Name => "Headless Mode Enable";

	public override string DisplayGroup => "Vendor Specific";

	public HeadlessModeEnableInfo(HeadlessModeEnable packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		HeadlessModeEnable headlessModeEnable = (HeadlessModeEnable)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub OpCode", "HCI_VSC_HEADLESS_ENABLE", 8, FormatValue(headlessModeEnable.UserFields.SubOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("LPM_WAKEUP_METHOD", HeadlessModeEnable.UserFieldsWrapper.LpmWakeupMethodInfo.LpmWakeupMethodToDescription(), 8, FormatValue(headlessModeEnable.UserFields.LpmWakeupMethod, 8), HeadlessModeEnable.UserFieldsWrapper.LpmWakeupMethodInfo.LpmWakeupMethodToString(HeadlessModeEnable.UserFieldsWrapper.LpmWakeupMethodInfo.ValueToLpmWakeupMethod(headlessModeEnable.UserFields.LpmWakeupMethod)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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