using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeConnectionSupplementalResponseEnableInfo : PacketInfoBase
{
	public override string Name => "Le Connection Supplemental Response Enable";

	public override string DisplayGroup => "LE Controller";

	public LeConnectionSupplementalResponseEnableInfo(LeConnectionSupplementalResponseEnable packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeConnectionSupplementalResponseEnable leConnectionSupplementalResponseEnable = (LeConnectionSupplementalResponseEnable)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Connection_Handle", "Connection_Handle to be used to identify a connection. Range 0x0000-0x0EFF (0x0F00 - 0x0FFF Reserved for future use)", 16, FormatValue(leConnectionSupplementalResponseEnable.UserFields.ConnectionHandle, 16), "", "0000", "0EFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("ENABLE", LeConnectionSupplementalResponseEnable.UserFieldsWrapper.EnableInfo.EnableToDescription(), 8, FormatValue(leConnectionSupplementalResponseEnable.UserFields.Enable, 8), LeConnectionSupplementalResponseEnable.UserFieldsWrapper.EnableInfo.EnableToString(LeConnectionSupplementalResponseEnable.UserFieldsWrapper.EnableInfo.ValueToEnable(leConnectionSupplementalResponseEnable.UserFields.Enable)), "0", "4", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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