using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class WriteBestEffortFlushTimeoutInfo : PacketInfoBase
{
	public override string Name => "Write Best Effort Flush Timeout";

	public override string DisplayGroup => "Host Control and Baseband";

	public WriteBestEffortFlushTimeoutInfo(WriteBestEffortFlushTimeout packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		WriteBestEffortFlushTimeout writeBestEffortFlushTimeout = (WriteBestEffortFlushTimeout)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Logical_Link_Handle", "Logical_Link_Handle to which the Write_Best_Effort_Flush_Timeout command applies. Range: 0x0000-0x0EFF.  Reserved for future use (0x0F00 - 0x0FFF)", 16, FormatValue(writeBestEffortFlushTimeout.UserFields.LogicalLinkHandle, 16), "", "0000", "0EFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Best_Effort_Flush_Timeout", WriteBestEffortFlushTimeout.UserFieldsWrapper.BestEffortFlushTimeoutInfo.BestEffortFlushTimeoutToDescription(), 32, FormatValue(writeBestEffortFlushTimeout.UserFields.BestEffortFlushTimeout, 32), WriteBestEffortFlushTimeout.UserFieldsWrapper.BestEffortFlushTimeoutInfo.BestEffortFlushTimeoutToString(WriteBestEffortFlushTimeout.UserFieldsWrapper.BestEffortFlushTimeoutInfo.ValueToBestEffortFlushTimeout(writeBestEffortFlushTimeout.UserFields.BestEffortFlushTimeout)), "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		WriteBestEffortFlushTimeout writeBestEffortFlushTimeout = (WriteBestEffortFlushTimeout)packet;
		int num = -1;
		if (index == ++num)
		{
			writeBestEffortFlushTimeout.UserFields.LogicalLinkHandle = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			writeBestEffortFlushTimeout.UserFields.BestEffortFlushTimeout = Convert.ToUInt32(value, 16);
		}
	}
}
