using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class SetLogConfigurationInfo : PacketInfoBase
{
	public override string Name => "Set Log Configuration";

	public override string DisplayGroup => "Diagnostic";

	public SetLogConfigurationInfo(SetLogConfiguration packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		SetLogConfiguration setLogConfiguration = (SetLogConfiguration)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Log", SetLogConfiguration.UserFieldsWrapper.LogInfo.LogToDescription(), 8, FormatValue(setLogConfiguration.UserFields.Log, 8), SetLogConfiguration.UserFieldsWrapper.LogInfo.LogToString(SetLogConfiguration.UserFieldsWrapper.LogInfo.ValueToLog(setLogConfiguration.UserFields.Log)), "", "1", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Log Audio", SetLogConfiguration.UserFieldsWrapper.LogAudioInfo.LogAudioToDescription(), 8, FormatValue(setLogConfiguration.UserFields.LogAudio, 8), SetLogConfiguration.UserFieldsWrapper.LogAudioInfo.LogAudioToString(SetLogConfiguration.UserFieldsWrapper.LogAudioInfo.ValueToLogAudio(setLogConfiguration.UserFields.LogAudio)), "", "1", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		SetLogConfiguration setLogConfiguration = (SetLogConfiguration)packet;
		int num = -1;
		if (index == ++num)
		{
			setLogConfiguration.UserFields.Log = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setLogConfiguration.UserFields.LogAudio = Convert.ToUInt32(value, 16);
		}
	}
}
