using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class RdsGroupProcessingInfo : PacketInfoBase
{
	public override string Name => "Rds Group Processing";

	public override string DisplayGroup => "Receiver Control";

	public RdsGroupProcessingInfo(RdsGroupProcessing packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		RdsGroupProcessing rdsGroupProcessing = (RdsGroupProcessing)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Groups To Process", "Bit 0: 1 = Process Radio Text\r\nBit 1: 1 = Process Program Service Name\r\nBit 2: 1 = Process RDS Simple Program Service Name\r\nBit 3: 1 = Process Alternative Frequency List\r\nBit 4: 1 = RDS Alternative Frequency Jump enabled", 32, FormatValue(rdsGroupProcessing.UserFields.GroupsToProcess, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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