using System;
using QCRPG.Framework;

namespace QCRPG.TSL.NFC.Packets;

public class CoreResetRspInfo : PacketInfoBase
{
	public override string Name => "Core Reset Rsp";

	public override string DisplayGroup => "NCI Core";

	public CoreResetRspInfo(CoreResetRsp packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		CoreResetRsp coreResetRsp = (CoreResetRsp)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Status", StatusCodesInfo.StatusCodesToDescription(), 8, FormatValue(coreResetRsp.UserFields.Status, 8), StatusCodesInfo.StatusCodesToString(StatusCodesInfo.ValueToStatusCodes(coreResetRsp.UserFields.Status)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("NCI Version", NciVersionInfo.NciVersionToDescription(), 8, FormatValue(coreResetRsp.UserFields.NciVersion, 8), NciVersionInfo.NciVersionToString(NciVersionInfo.ValueToNciVersion(coreResetRsp.UserFields.NciVersion)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Configuration Status", ConfigurationStatusInfo.ConfigurationStatusToDescription(), 8, FormatValue(coreResetRsp.UserFields.ConfigurationStatus, 8), ConfigurationStatusInfo.ConfigurationStatusToString(ConfigurationStatusInfo.ValueToConfigurationStatus(coreResetRsp.UserFields.ConfigurationStatus)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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