using System;
using QCRPG.Framework;

namespace QCRPG.TSL.NFC.Packets;

public class NfceeModeSetCmdInfo : PacketInfoBase
{
	public override string Name => "Nfcee Mode Set Cmd";

	public override string DisplayGroup => "NFCEE Management";

	public NfceeModeSetCmdInfo(NfceeModeSetCmd packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		NfceeModeSetCmd nfceeModeSetCmd = (NfceeModeSetCmd)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("NFCEE ID", NfceeIdsInfo.NfceeIdsToDescription(), 8, FormatValue(nfceeModeSetCmd.UserFields.NfceeId, 8), NfceeIdsInfo.NfceeIdsToString(NfceeIdsInfo.ValueToNfceeIds(nfceeModeSetCmd.UserFields.NfceeId)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("NFCEE Mode", NfceeModeSetCmd.UserFieldsWrapper.NfceeModeInfo.NfceeModeToDescription(), 8, FormatValue(nfceeModeSetCmd.UserFields.NfceeMode, 8), NfceeModeSetCmd.UserFieldsWrapper.NfceeModeInfo.NfceeModeToString(NfceeModeSetCmd.UserFieldsWrapper.NfceeModeInfo.ValueToNfceeMode(nfceeModeSetCmd.UserFields.NfceeMode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		NfceeModeSetCmd nfceeModeSetCmd = (NfceeModeSetCmd)packet;
		int num = -1;
		if (index == ++num)
		{
			nfceeModeSetCmd.UserFields.NfceeId = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			nfceeModeSetCmd.UserFields.NfceeMode = Convert.ToUInt32(value, 16);
		}
	}
}
