using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeApcfEnableInfo : PacketInfoBase
{
	public override string Name => "Le Apcf Enable";

	public override string DisplayGroup => "Vendor Specific";

	public LeApcfEnableInfo(LeApcfEnable packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeApcfEnable leApcfEnable = (LeApcfEnable)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("APCF_opcode", "APCF Enable", 8, FormatValue(leApcfEnable.UserFields.ApcfOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("APCF_enable", LeApcfEnable.UserFieldsWrapper.ApcfEnableInfo.ApcfEnableToDescription(), 8, FormatValue(leApcfEnable.UserFields.ApcfEnable, 8), LeApcfEnable.UserFieldsWrapper.ApcfEnableInfo.ApcfEnableToString(LeApcfEnable.UserFieldsWrapper.ApcfEnableInfo.ValueToApcfEnable(leApcfEnable.UserFields.ApcfEnable)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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