using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeSetScanEnabledInfo : PacketInfoBase
{
	public override string Name => "Le Set Scan Enabled";

	public override string DisplayGroup => "LE Controller";

	public LeSetScanEnabledInfo(LeSetScanEnabled packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeSetScanEnabled leSetScanEnabled = (LeSetScanEnabled)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("LE_Scan_Enable", LeScanEnableInfo.LeScanEnableToDescription(), 8, FormatValue(leSetScanEnabled.UserFields.LeScanEnable, 8), LeScanEnableInfo.LeScanEnableToString(LeScanEnableInfo.ValueToLeScanEnable(leSetScanEnabled.UserFields.LeScanEnable)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Filter_Duplicates", LeSetScanEnabled.UserFieldsWrapper.FilterDuplicatesInfo.FilterDuplicatesToDescription(), 8, FormatValue(leSetScanEnabled.UserFields.FilterDuplicates, 8), LeSetScanEnabled.UserFieldsWrapper.FilterDuplicatesInfo.FilterDuplicatesToString(LeSetScanEnabled.UserFieldsWrapper.FilterDuplicatesInfo.ValueToFilterDuplicates(leSetScanEnabled.UserFields.FilterDuplicates)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LeSetScanEnabled leSetScanEnabled = (LeSetScanEnabled)packet;
		int num = -1;
		if (index == ++num)
		{
			leSetScanEnabled.UserFields.LeScanEnable = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leSetScanEnabled.UserFields.FilterDuplicates = Convert.ToUInt32(value, 16);
		}
	}
}
