using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class WriteNumBroadcastRetransInfo : PacketInfoBase
{
	public override string Name => "Write Num Broadcast Retrans";

	public override string DisplayGroup => "Host Control and Baseband";

	public WriteNumBroadcastRetransInfo(WriteNumBroadcastRetrans packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		WriteNumBroadcastRetrans writeNumBroadcastRetrans = (WriteNumBroadcastRetrans)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Num Broadcast Retransmissions", "The Number of Broadcast Retransmissions parameter, N, is used to increase the reliability of a broadcast message by retransmitting the broadcast message multiple times.", 8, FormatValue(writeNumBroadcastRetrans.UserFields.NumBroadcastRetransmissions, 8), "", "00", "FE", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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