using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeSetHostFeatureInfo : PacketInfoBase
{
	public override string Name => "Le Set Host Feature";

	public override string DisplayGroup => "LE Controller";

	public LeSetHostFeatureInfo(LeSetHostFeature packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeSetHostFeature leSetHostFeature = (LeSetHostFeature)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Bit_Number", "", 8, FormatValue(leSetHostFeature.UserFields.BitNumber, 8), "", "00", "3F", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Bit_Value", AssertBitInfo.AssertBitToDescription(), 8, FormatValue(leSetHostFeature.UserFields.BitValue, 8), AssertBitInfo.AssertBitToString(AssertBitInfo.ValueToAssertBit(leSetHostFeature.UserFields.BitValue)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LeSetHostFeature leSetHostFeature = (LeSetHostFeature)packet;
		int num = -1;
		if (index == ++num)
		{
			leSetHostFeature.UserFields.BitNumber = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leSetHostFeature.UserFields.BitValue = Convert.ToUInt32(value, 16);
		}
	}
}
