using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LegacyAssociationNotificationInfo : PacketInfoBase
{
	public override string Name => "Legacy Association Notification";

	public override string DisplayGroup => "Vendor Specific";

	public LegacyAssociationNotificationInfo(LegacyAssociationNotification packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LegacyAssociationNotification legacyAssociationNotification = (LegacyAssociationNotification)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Association_Enable", LegacyAssociationNotification.UserFieldsWrapper.AssociationEnableInfo.AssociationEnableToDescription(), 8, FormatValue(legacyAssociationNotification.UserFields.AssociationEnable, 8), LegacyAssociationNotification.UserFieldsWrapper.AssociationEnableInfo.AssociationEnableToString(LegacyAssociationNotification.UserFieldsWrapper.AssociationEnableInfo.ValueToAssociationEnable(legacyAssociationNotification.UserFields.AssociationEnable)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LegacyAssociationNotification legacyAssociationNotification = (LegacyAssociationNotification)packet;
		int num = -1;
		if (index == ++num)
		{
			legacyAssociationNotification.UserFields.AssociationEnable = Convert.ToUInt32(value, 16);
		}
	}
}
