using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeRpaOffloadReadIrkListInfo : PacketInfoBase
{
	public override string Name => "Le Rpa Offload Read Irk List";

	public override string DisplayGroup => "Vendor Specific";

	public LeRpaOffloadReadIrkListInfo(LeRpaOffloadReadIrkList packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeRpaOffloadReadIrkList leRpaOffloadReadIrkList = (LeRpaOffloadReadIrkList)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("RPA_offload_opcode", "Read IRK List Entry", 8, FormatValue(leRpaOffloadReadIrkList.UserFields.RpaOffloadOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("LE_Read_IRK_List_entry_index", "index in to IRK list [0, max_irk_list_sz1]", 8, FormatValue(leRpaOffloadReadIrkList.UserFields.LeReadIrkListEntryIndex, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LeRpaOffloadReadIrkList leRpaOffloadReadIrkList = (LeRpaOffloadReadIrkList)packet;
		int num = -1;
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field RpaOffloadOpcode");
		}
		if (index == ++num)
		{
			leRpaOffloadReadIrkList.UserFields.LeReadIrkListEntryIndex = Convert.ToUInt32(value, 16);
		}
	}
}
