using System;
using QCRPG.Framework;

namespace QCRPG.TSL.NFC.Packets;

public class RfT3tPollingCmdInfo : PacketInfoBase
{
	public override string Name => "Rf T3t Polling Cmd";

	public override string DisplayGroup => "RF Management";

	public RfT3tPollingCmdInfo(RfT3tPollingCmd packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		RfT3tPollingCmd rfT3tPollingCmd = (RfT3tPollingCmd)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("SENSF_REQ_PARAMS-SC_1", "", 8, FormatValue(rfT3tPollingCmd.UserFields.SensfReqParamsSc1, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("SENSF_REQ_PARAMS-SC_2", "", 8, FormatValue(rfT3tPollingCmd.UserFields.SensfReqParamsSc2, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("SENSF_REQ_PARAMS-RC", "", 8, FormatValue(rfT3tPollingCmd.UserFields.SensfReqParamsRc, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("SENSF_REQ_PARAMS-TSN", "", 8, FormatValue(rfT3tPollingCmd.UserFields.SensfReqParamsTsn, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		RfT3tPollingCmd rfT3tPollingCmd = (RfT3tPollingCmd)packet;
		int num = -1;
		if (index == ++num)
		{
			rfT3tPollingCmd.UserFields.SensfReqParamsSc1 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			rfT3tPollingCmd.UserFields.SensfReqParamsSc2 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			rfT3tPollingCmd.UserFields.SensfReqParamsRc = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			rfT3tPollingCmd.UserFields.SensfReqParamsTsn = Convert.ToUInt32(value, 16);
		}
	}
}
