using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class AsyncEventControlInfo : PacketInfoBase
{
	public override string Name => "Async Event Control";

	public override string DisplayGroup => "Receiver Control";

	public AsyncEventControlInfo(AsyncEventControl packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		AsyncEventControl asyncEventControl = (AsyncEventControl)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Event Control Bitmask", "Bit 0: 1 = Enable signal level state change event\r\nBit 1: 1 = Enable RDS synchronization state change event\r\nBit 2: 1 = Enable audio control indicator event", 8, FormatValue(asyncEventControl.UserFields.EventControlBitmask, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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