using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class WritePinTypeInfo : PacketInfoBase
{
	public override string Name => "Write Pin Type";

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

	public WritePinTypeInfo(WritePinType packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		WritePinType writePinType = (WritePinType)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("PIN Type", WritePinType.UserFieldsWrapper.PinTypeInfo.PinTypeToDescription(), 8, FormatValue(writePinType.UserFields.PinType, 8), WritePinType.UserFieldsWrapper.PinTypeInfo.PinTypeToString(WritePinType.UserFieldsWrapper.PinTypeInfo.ValueToPinType(writePinType.UserFields.PinType)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		WritePinType writePinType = (WritePinType)packet;
		int num = -1;
		if (index == ++num)
		{
			writePinType.UserFields.PinType = Convert.ToUInt32(value, 16);
		}
	}
}
