using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class EnhancedFlushInfo : PacketInfoBase
{
	public override string Name => "Enhanced Flush";

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

	public EnhancedFlushInfo(EnhancedFlush packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		EnhancedFlush enhancedFlush = (EnhancedFlush)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Handle", "Handle to be used to identify a connection. The Handle is a Connection Handle for a BR/EDR Controller and a Logical Link Handle for an AMP Controller. Range: 0x0000-0x0EFF.  Reserved for future use (0x0F00 - 0x0FFF)", 16, FormatValue(enhancedFlush.UserFields.Handle, 16), "", "0000", "0EFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Packet_Type", EnhancedFlush.UserFieldsWrapper.PacketTypeInfo.PacketTypeToDescription(), 8, FormatValue(enhancedFlush.UserFields.PacketType, 8), EnhancedFlush.UserFieldsWrapper.PacketTypeInfo.PacketTypeToString(EnhancedFlush.UserFieldsWrapper.PacketTypeInfo.ValueToPacketType(enhancedFlush.UserFields.PacketType)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		EnhancedFlush enhancedFlush = (EnhancedFlush)packet;
		int num = -1;
		if (index == ++num)
		{
			enhancedFlush.UserFields.Handle = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			enhancedFlush.UserFields.PacketType = Convert.ToUInt32(value, 16);
		}
	}
}
