using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeRemoveDeviceFromWhiteListInfo : PacketInfoBase
{
	public override string Name => "Le Remove Device From White List";

	public override string DisplayGroup => "LE Controller";

	public LeRemoveDeviceFromWhiteListInfo(LeRemoveDeviceFromWhiteList packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeRemoveDeviceFromWhiteList leRemoveDeviceFromWhiteList = (LeRemoveDeviceFromWhiteList)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Address_Type", WhiteListAddressTypeInfo.WhiteListAddressTypeToDescription(), 8, FormatValue(leRemoveDeviceFromWhiteList.UserFields.AddressType, 8), WhiteListAddressTypeInfo.WhiteListAddressTypeToString(WhiteListAddressTypeInfo.ValueToWhiteListAddressType(leRemoveDeviceFromWhiteList.UserFields.AddressType)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Address", "Public Device Address or Random Device Address of the device to be removed from the White List", 48, FormatValue(leRemoveDeviceFromWhiteList.UserFields.Address, 48), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LeRemoveDeviceFromWhiteList leRemoveDeviceFromWhiteList = (LeRemoveDeviceFromWhiteList)packet;
		int num = -1;
		if (index == ++num)
		{
			leRemoveDeviceFromWhiteList.UserFields.AddressType = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leRemoveDeviceFromWhiteList.UserFields.Address = Convert.ToUInt64(value, 16);
		}
	}
}
