using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class CommandCompleteForLeReadBufferSizeV2Info : PacketInfoBase
{
	public override string Name => "Command Complete For Le Read Buffer Size V2";

	public override string DisplayGroup => "LE Controller";

	public CommandCompleteForLeReadBufferSizeV2Info(CommandCompleteForLeReadBufferSizeV2 packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		CommandCompleteForLeReadBufferSizeV2 commandCompleteForLeReadBufferSizeV = (CommandCompleteForLeReadBufferSizeV2)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Num HCI Command Packets", "", 8, FormatValue(commandCompleteForLeReadBufferSizeV.UserFields.NumHciCommandPackets, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Command OpCode", CommandOpcodeInfo.CommandOpcodeToDescription(), 16, FormatValue(commandCompleteForLeReadBufferSizeV.UserFields.CommandOpcode, 16), CommandOpcodeInfo.CommandOpcodeToString(CommandOpcodeInfo.ValueToCommandOpcode(commandCompleteForLeReadBufferSizeV.UserFields.CommandOpcode)), "", "", settable: false, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Status", ErrorCodeInfo.ErrorCodeToDescription(), 8, FormatValue(commandCompleteForLeReadBufferSizeV.UserFields.Status, 8), ErrorCodeInfo.ErrorCodeToString(ErrorCodeInfo.ValueToErrorCode(commandCompleteForLeReadBufferSizeV.UserFields.Status)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("LE_ACL_Data_Packet_Length", CommandCompleteForLeReadBufferSizeV2.UserFieldsWrapper.LeAclDataPacketLengthInfo.LeAclDataPacketLengthToDescription(), 16, FormatValue(commandCompleteForLeReadBufferSizeV.UserFields.LeAclDataPacketLength, 16), CommandCompleteForLeReadBufferSizeV2.UserFieldsWrapper.LeAclDataPacketLengthInfo.LeAclDataPacketLengthToString(CommandCompleteForLeReadBufferSizeV2.UserFieldsWrapper.LeAclDataPacketLengthInfo.ValueToLeAclDataPacketLength(commandCompleteForLeReadBufferSizeV.UserFields.LeAclDataPacketLength)), "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Total_Num_LE_Data_Packets", CommandCompleteForLeReadBufferSizeV2.UserFieldsWrapper.TotalNumLeDataPacketsInfo.TotalNumLeDataPacketsToDescription(), 8, FormatValue(commandCompleteForLeReadBufferSizeV.UserFields.TotalNumLeDataPackets, 8), CommandCompleteForLeReadBufferSizeV2.UserFieldsWrapper.TotalNumLeDataPacketsInfo.TotalNumLeDataPacketsToString(CommandCompleteForLeReadBufferSizeV2.UserFieldsWrapper.TotalNumLeDataPacketsInfo.ValueToTotalNumLeDataPackets(commandCompleteForLeReadBufferSizeV.UserFields.TotalNumLeDataPackets)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("ISO_Data_Packet_Length", CommandCompleteForLeReadBufferSizeV2.UserFieldsWrapper.IsoDataPacketLengthInfo.IsoDataPacketLengthToDescription(), 16, FormatValue(commandCompleteForLeReadBufferSizeV.UserFields.IsoDataPacketLength, 16), CommandCompleteForLeReadBufferSizeV2.UserFieldsWrapper.IsoDataPacketLengthInfo.IsoDataPacketLengthToString(CommandCompleteForLeReadBufferSizeV2.UserFieldsWrapper.IsoDataPacketLengthInfo.ValueToIsoDataPacketLength(commandCompleteForLeReadBufferSizeV.UserFields.IsoDataPacketLength)), "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Total_Num_ISO_Data_Packets", CommandCompleteForLeReadBufferSizeV2.UserFieldsWrapper.TotalNumIsoDataPacketsInfo.TotalNumIsoDataPacketsToDescription(), 8, FormatValue(commandCompleteForLeReadBufferSizeV.UserFields.TotalNumIsoDataPackets, 8), CommandCompleteForLeReadBufferSizeV2.UserFieldsWrapper.TotalNumIsoDataPacketsInfo.TotalNumIsoDataPacketsToString(CommandCompleteForLeReadBufferSizeV2.UserFieldsWrapper.TotalNumIsoDataPacketsInfo.ValueToTotalNumIsoDataPackets(commandCompleteForLeReadBufferSizeV.UserFields.TotalNumIsoDataPackets)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		CommandCompleteForLeReadBufferSizeV2 commandCompleteForLeReadBufferSizeV = (CommandCompleteForLeReadBufferSizeV2)packet;
		int num = -1;
		if (index == ++num)
		{
			commandCompleteForLeReadBufferSizeV.UserFields.NumHciCommandPackets = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field CommandOpcode");
		}
		if (index == ++num)
		{
			commandCompleteForLeReadBufferSizeV.UserFields.Status = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeReadBufferSizeV.UserFields.LeAclDataPacketLength = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeReadBufferSizeV.UserFields.TotalNumLeDataPackets = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeReadBufferSizeV.UserFields.IsoDataPacketLength = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForLeReadBufferSizeV.UserFields.TotalNumIsoDataPackets = Convert.ToUInt32(value, 16);
		}
	}
}
