using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class InquiryCompleteInfo : PacketInfoBase
{
	public override string Name => "Inquiry Complete";

	public override string DisplayGroup => "Link Control";

	public InquiryCompleteInfo(InquiryComplete packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		InquiryComplete inquiryComplete = (InquiryComplete)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Status", ErrorCodeInfo.ErrorCodeToDescription(), 8, FormatValue(inquiryComplete.UserFields.Status, 8), ErrorCodeInfo.ErrorCodeToString(ErrorCodeInfo.ValueToErrorCode(inquiryComplete.UserFields.Status)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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