using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeSetTransmitPowerReportingEnableInfo : PacketInfoBase
{
	public override string Name => "Le Set Transmit Power Reporting Enable";

	public override string DisplayGroup => "LE Controller";

	public LeSetTransmitPowerReportingEnableInfo(LeSetTransmitPowerReportingEnable packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeSetTransmitPowerReportingEnable leSetTransmitPowerReportingEnable = (LeSetTransmitPowerReportingEnable)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Connection Handle", "Connection handle for the LE connection.", 16, FormatValue(leSetTransmitPowerReportingEnable.UserFields.ConnectionHandle, 16), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Local Enable", "Enable or Disable local transmit power reports.\r\n\r\n" + LeSetTransmitPowerReportingEnable.UserFieldsWrapper.LocalEnableInfo.LocalEnableToDescription(), 8, FormatValue(leSetTransmitPowerReportingEnable.UserFields.LocalEnable, 8), LeSetTransmitPowerReportingEnable.UserFieldsWrapper.LocalEnableInfo.LocalEnableToString(LeSetTransmitPowerReportingEnable.UserFieldsWrapper.LocalEnableInfo.ValueToLocalEnable(leSetTransmitPowerReportingEnable.UserFields.LocalEnable)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Remote Enable", "Enable or Disable remote transmit power reports.\r\n\r\n" + LeSetTransmitPowerReportingEnable.UserFieldsWrapper.RemoteEnableInfo.RemoteEnableToDescription(), 8, FormatValue(leSetTransmitPowerReportingEnable.UserFields.RemoteEnable, 8), LeSetTransmitPowerReportingEnable.UserFieldsWrapper.RemoteEnableInfo.RemoteEnableToString(LeSetTransmitPowerReportingEnable.UserFieldsWrapper.RemoteEnableInfo.ValueToRemoteEnable(leSetTransmitPowerReportingEnable.UserFields.RemoteEnable)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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