using System;
using QCRPG.Framework;

namespace QCRPG.TSL.NFC.Packets;

public class RfDeactivateNtfInfo : PacketInfoBase
{
	public override string Name => "Rf Deactivate Ntf";

	public override string DisplayGroup => "RF Management";

	public RfDeactivateNtfInfo(RfDeactivateNtf packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		RfDeactivateNtf rfDeactivateNtf = (RfDeactivateNtf)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Deactivation Type", DeactivationTypesInfo.DeactivationTypesToDescription(), 8, FormatValue(rfDeactivateNtf.UserFields.DeactivationType, 8), DeactivationTypesInfo.DeactivationTypesToString(DeactivationTypesInfo.ValueToDeactivationTypes(rfDeactivateNtf.UserFields.DeactivationType)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Deactivation Reason", DeactivationReasonsInfo.DeactivationReasonsToDescription(), 8, FormatValue(rfDeactivateNtf.UserFields.DeactivationReason, 8), DeactivationReasonsInfo.DeactivationReasonsToString(DeactivationReasonsInfo.ValueToDeactivationReasons(rfDeactivateNtf.UserFields.DeactivationReason)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		RfDeactivateNtf rfDeactivateNtf = (RfDeactivateNtf)packet;
		int num = -1;
		if (index == ++num)
		{
			rfDeactivateNtf.UserFields.DeactivationType = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			rfDeactivateNtf.UserFields.DeactivationReason = Convert.ToUInt32(value, 16);
		}
	}
}
