using System;
using QCRPG.Framework;

namespace QCRPG.TSL.NFC.Packets;

public class CoreResetNtfInfo : PacketInfoBase
{
	public override string Name => "Core Reset Ntf";

	public override string DisplayGroup => "NCI Core";

	public CoreResetNtfInfo(CoreResetNtf packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		CoreResetNtf coreResetNtf = (CoreResetNtf)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Reason Code", CoreResetNtf.UserFieldsWrapper.ReasonCodeInfo.ReasonCodeToDescription(), 8, FormatValue(coreResetNtf.UserFields.ReasonCode, 8), CoreResetNtf.UserFieldsWrapper.ReasonCodeInfo.ReasonCodeToString(CoreResetNtf.UserFieldsWrapper.ReasonCodeInfo.ValueToReasonCode(coreResetNtf.UserFields.ReasonCode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Configuration Status", ConfigurationStatusInfo.ConfigurationStatusToDescription(), 8, FormatValue(coreResetNtf.UserFields.ConfigurationStatus, 8), ConfigurationStatusInfo.ConfigurationStatusToString(ConfigurationStatusInfo.ValueToConfigurationStatus(coreResetNtf.UserFields.ConfigurationStatus)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		CoreResetNtf coreResetNtf = (CoreResetNtf)packet;
		int num = -1;
		if (index == ++num)
		{
			coreResetNtf.UserFields.ReasonCode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			coreResetNtf.UserFields.ConfigurationStatus = Convert.ToUInt32(value, 16);
		}
	}
}
