using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class TuneInfo : PacketInfoBase
{
	public override string Name => "Tune";

	public override string DisplayGroup => "Production Test Mode";

	public TuneInfo(Tune packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		Tune tune = (Tune)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Tune Frequency", "Frequency to tune in kHz", 32, FormatValue(tune.UserFields.TuneFrequency, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.DecimalInteger));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		Tune tune = (Tune)packet;
		int num = -1;
		if (index == ++num)
		{
			tune.UserFields.TuneFrequency = Convert.ToUInt32(value, 16);
		}
	}
}
