using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

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

	public override string DisplayGroup => "LE Controller";

	public LeConnectionSupplementalRequestEnableInfo(LeConnectionSupplementalRequestEnable packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeConnectionSupplementalRequestEnable leConnectionSupplementalRequestEnable = (LeConnectionSupplementalRequestEnable)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(leConnectionSupplementalRequestEnable.UserFields.ConnectionHandle, 16), "", "0000", "0EFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Enable", LeConnectionSupplementalRequestEnable.UserFieldsWrapper.EnableInfo.EnableToDescription(), 8, FormatValue(leConnectionSupplementalRequestEnable.UserFields.Enable, 8), LeConnectionSupplementalRequestEnable.UserFieldsWrapper.EnableInfo.EnableToString(LeConnectionSupplementalRequestEnable.UserFieldsWrapper.EnableInfo.ValueToEnable(leConnectionSupplementalRequestEnable.UserFields.Enable)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Supplemental_Request_Interval", LeConnectionSupplementalRequestEnable.UserFieldsWrapper.SupplementalRequestIntervalInfo.SupplementalRequestIntervalToDescription(), 16, FormatValue(leConnectionSupplementalRequestEnable.UserFields.SupplementalRequestInterval, 16), LeConnectionSupplementalRequestEnable.UserFieldsWrapper.SupplementalRequestIntervalInfo.SupplementalRequestIntervalToString(LeConnectionSupplementalRequestEnable.UserFieldsWrapper.SupplementalRequestIntervalInfo.ValueToSupplementalRequestInterval(leConnectionSupplementalRequestEnable.UserFields.SupplementalRequestInterval)), "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Requested_Supplemental_Length", LeConnectionSupplementalRequestEnable.UserFieldsWrapper.RequestedSupplementalLengthInfo.RequestedSupplementalLengthToDescription(), 8, FormatValue(leConnectionSupplementalRequestEnable.UserFields.RequestedSupplementalLength, 8), LeConnectionSupplementalRequestEnable.UserFieldsWrapper.RequestedSupplementalLengthInfo.RequestedSupplementalLengthToString(LeConnectionSupplementalRequestEnable.UserFieldsWrapper.RequestedSupplementalLengthInfo.ValueToRequestedSupplementalLength(leConnectionSupplementalRequestEnable.UserFields.RequestedSupplementalLength)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Requested_Supplemental_Type", AodSupplementalTypeInfo.AodSupplementalTypeToDescription(), 8, FormatValue(leConnectionSupplementalRequestEnable.UserFields.RequestedSupplementalType, 8), AodSupplementalTypeInfo.AodSupplementalTypeToString(AodSupplementalTypeInfo.ValueToAodSupplementalType(leConnectionSupplementalRequestEnable.UserFields.RequestedSupplementalType)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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