using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class CommandCompleteForLeRpaOffloadClearIrkListInfo : PacketInfoBase
{
	public override string Name => "Command Complete For Le Rpa Offload Clear Irk List";

	public override string DisplayGroup => "Vendor Specific";

	public CommandCompleteForLeRpaOffloadClearIrkListInfo(CommandCompleteForLeRpaOffloadClearIrkList packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		CommandCompleteForLeRpaOffloadClearIrkList commandCompleteForLeRpaOffloadClearIrkList = (CommandCompleteForLeRpaOffloadClearIrkList)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Num HCI Command Packets", "", 8, FormatValue(commandCompleteForLeRpaOffloadClearIrkList.UserFields.NumHciCommandPackets, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Command OpCode", CommandOpcodeInfo.CommandOpcodeToDescription(), 16, FormatValue(commandCompleteForLeRpaOffloadClearIrkList.UserFields.CommandOpcode, 16), CommandOpcodeInfo.CommandOpcodeToString(CommandOpcodeInfo.ValueToCommandOpcode(commandCompleteForLeRpaOffloadClearIrkList.UserFields.CommandOpcode)), "", "", settable: false, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Status", ErrorCodeInfo.ErrorCodeToDescription(), 8, FormatValue(commandCompleteForLeRpaOffloadClearIrkList.UserFields.Status, 8), ErrorCodeInfo.ErrorCodeToString(ErrorCodeInfo.ValueToErrorCode(commandCompleteForLeRpaOffloadClearIrkList.UserFields.Status)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("RPA_offload_opcode", "Clear IRK list", 8, FormatValue(commandCompleteForLeRpaOffloadClearIrkList.UserFields.RpaOffloadOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("LE_Irk_List_Available_Spaces", "Available IRL list entries after current operation [max_irk_list_sz]", 8, FormatValue(commandCompleteForLeRpaOffloadClearIrkList.UserFields.LeIrkListAvailableSpaces, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		CommandCompleteForLeRpaOffloadClearIrkList commandCompleteForLeRpaOffloadClearIrkList = (CommandCompleteForLeRpaOffloadClearIrkList)packet;
		int num = -1;
		if (index == ++num)
		{
			commandCompleteForLeRpaOffloadClearIrkList.UserFields.NumHciCommandPackets = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field CommandOpcode");
		}
		if (index == ++num)
		{
			commandCompleteForLeRpaOffloadClearIrkList.UserFields.Status = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field RpaOffloadOpcode");
		}
		if (index == ++num)
		{
			commandCompleteForLeRpaOffloadClearIrkList.UserFields.LeIrkListAvailableSpaces = Convert.ToUInt32(value, 16);
		}
	}
}
