using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class CommandCompleteForSetGetResetAgcInfo : PacketInfoBase
{
	public override string Name => "Command Complete For Set Get Reset Agc";

	public override string DisplayGroup => "Diagnostic";

	public CommandCompleteForSetGetResetAgcInfo(CommandCompleteForSetGetResetAgc packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		CommandCompleteForSetGetResetAgc commandCompleteForSetGetResetAgc = (CommandCompleteForSetGetResetAgc)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Num HCI Command Packets", "", 8, FormatValue(commandCompleteForSetGetResetAgc.UserFields.NumHciCommandPackets, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Command OpCode", CommandOpcodeInfo.CommandOpcodeToDescription(), 16, FormatValue(commandCompleteForSetGetResetAgc.UserFields.CommandOpcode, 16), CommandOpcodeInfo.CommandOpcodeToString(CommandOpcodeInfo.ValueToCommandOpcode(commandCompleteForSetGetResetAgc.UserFields.CommandOpcode)), "", "", settable: false, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Status", ErrorCodeInfo.ErrorCodeToDescription(), 8, FormatValue(commandCompleteForSetGetResetAgc.UserFields.Status, 8), ErrorCodeInfo.ErrorCodeToString(ErrorCodeInfo.ValueToErrorCode(commandCompleteForSetGetResetAgc.UserFields.Status)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("ucCurrentGainState", CommandCompleteForSetGetResetAgc.UserFieldsWrapper.UccurrentgainstateInfo.UccurrentgainstateToDescription(), 8, FormatValue(commandCompleteForSetGetResetAgc.UserFields.Uccurrentgainstate, 8), CommandCompleteForSetGetResetAgc.UserFieldsWrapper.UccurrentgainstateInfo.UccurrentgainstateToString(CommandCompleteForSetGetResetAgc.UserFieldsWrapper.UccurrentgainstateInfo.ValueToUccurrentgainstate(commandCompleteForSetGetResetAgc.UserFields.Uccurrentgainstate)), "", "5", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("ucGainStateChange1", CommandCompleteForSetGetResetAgc.UserFieldsWrapper.Ucgainstatechange1Info.Ucgainstatechange1ToDescription(), 8, FormatValue(commandCompleteForSetGetResetAgc.UserFields.Ucgainstatechange1, 8), CommandCompleteForSetGetResetAgc.UserFieldsWrapper.Ucgainstatechange1Info.Ucgainstatechange1ToString(CommandCompleteForSetGetResetAgc.UserFieldsWrapper.Ucgainstatechange1Info.ValueToUcgainstatechange1(commandCompleteForSetGetResetAgc.UserFields.Ucgainstatechange1)), "", "5", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("ucGainStateChange2", CommandCompleteForSetGetResetAgc.UserFieldsWrapper.Ucgainstatechange2Info.Ucgainstatechange2ToDescription(), 8, FormatValue(commandCompleteForSetGetResetAgc.UserFields.Ucgainstatechange2, 8), CommandCompleteForSetGetResetAgc.UserFieldsWrapper.Ucgainstatechange2Info.Ucgainstatechange2ToString(CommandCompleteForSetGetResetAgc.UserFieldsWrapper.Ucgainstatechange2Info.ValueToUcgainstatechange2(commandCompleteForSetGetResetAgc.UserFields.Ucgainstatechange2)), "", "5", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("ucGainStateChange3", CommandCompleteForSetGetResetAgc.UserFieldsWrapper.Ucgainstatechange3Info.Ucgainstatechange3ToDescription(), 8, FormatValue(commandCompleteForSetGetResetAgc.UserFields.Ucgainstatechange3, 8), CommandCompleteForSetGetResetAgc.UserFieldsWrapper.Ucgainstatechange3Info.Ucgainstatechange3ToString(CommandCompleteForSetGetResetAgc.UserFieldsWrapper.Ucgainstatechange3Info.ValueToUcgainstatechange3(commandCompleteForSetGetResetAgc.UserFields.Ucgainstatechange3)), "", "5", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		CommandCompleteForSetGetResetAgc commandCompleteForSetGetResetAgc = (CommandCompleteForSetGetResetAgc)packet;
		int num = -1;
		if (index == ++num)
		{
			commandCompleteForSetGetResetAgc.UserFields.NumHciCommandPackets = Convert.ToUInt32(value, 16);
			return;
		}
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field CommandOpcode");
		}
		if (index == ++num)
		{
			commandCompleteForSetGetResetAgc.UserFields.Status = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForSetGetResetAgc.UserFields.Uccurrentgainstate = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForSetGetResetAgc.UserFields.Ucgainstatechange1 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForSetGetResetAgc.UserFields.Ucgainstatechange2 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			commandCompleteForSetGetResetAgc.UserFields.Ucgainstatechange3 = Convert.ToUInt32(value, 16);
		}
	}
}
