using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeSetPathLossReportingEnableInfo : PacketInfoBase
{
	public override string Name => "Le Set Path Loss Reporting Enable";

	public override string DisplayGroup => "LE Controller";

	public LeSetPathLossReportingEnableInfo(LeSetPathLossReportingEnable packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeSetPathLossReportingEnable leSetPathLossReportingEnable = (LeSetPathLossReportingEnable)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Connection Handle", "Connection handle for the LE connection.", 16, FormatValue(leSetPathLossReportingEnable.UserFields.ConnectionHandle, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Enable", "Enable or Disable Path Loss Reporting.\r\n\r\n" + LeSetPathLossReportingEnable.UserFieldsWrapper.EnableInfo.EnableToDescription(), 8, FormatValue(leSetPathLossReportingEnable.UserFields.Enable, 8), LeSetPathLossReportingEnable.UserFieldsWrapper.EnableInfo.EnableToString(LeSetPathLossReportingEnable.UserFieldsWrapper.EnableInfo.ValueToEnable(leSetPathLossReportingEnable.UserFields.Enable)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LeSetPathLossReportingEnable leSetPathLossReportingEnable = (LeSetPathLossReportingEnable)packet;
		int num = -1;
		if (index == ++num)
		{
			leSetPathLossReportingEnable.UserFields.ConnectionHandle = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leSetPathLossReportingEnable.UserFields.Enable = Convert.ToUInt32(value, 16);
		}
	}
}
