using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeRemoveDeviceFromPeriodicAdvertiserListInfo : PacketInfoBase
{
	public override string Name => "Le Remove Device From Periodic Advertiser List";

	public override string DisplayGroup => "LE Controller";

	public LeRemoveDeviceFromPeriodicAdvertiserListInfo(LeRemoveDeviceFromPeriodicAdvertiserList packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeRemoveDeviceFromPeriodicAdvertiserList leRemoveDeviceFromPeriodicAdvertiserList = (LeRemoveDeviceFromPeriodicAdvertiserList)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Advertiser_Address_Type", PeerAddressTypeInfo.PeerAddressTypeToDescription(), 8, FormatValue(leRemoveDeviceFromPeriodicAdvertiserList.UserFields.AdvertiserAddressType, 8), PeerAddressTypeInfo.PeerAddressTypeToString(PeerAddressTypeInfo.ValueToPeerAddressType(leRemoveDeviceFromPeriodicAdvertiserList.UserFields.AdvertiserAddressType)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Advertiser_Address", "Public Device Address, Random Device Address, Public Identity Address, or Random (static) Identity Address of the advertiser.", 48, FormatValue(leRemoveDeviceFromPeriodicAdvertiserList.UserFields.AdvertiserAddress, 48), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Advertising_SID", "Advertising SID subfield in the ADI field used to identify the Periodic Advertising", 8, FormatValue(leRemoveDeviceFromPeriodicAdvertiserList.UserFields.AdvertisingSid, 8), "", "00", "0F", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LeRemoveDeviceFromPeriodicAdvertiserList leRemoveDeviceFromPeriodicAdvertiserList = (LeRemoveDeviceFromPeriodicAdvertiserList)packet;
		int num = -1;
		if (index == ++num)
		{
			leRemoveDeviceFromPeriodicAdvertiserList.UserFields.AdvertiserAddressType = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leRemoveDeviceFromPeriodicAdvertiserList.UserFields.AdvertiserAddress = Convert.ToUInt64(value, 16);
		}
		else if (index == ++num)
		{
			leRemoveDeviceFromPeriodicAdvertiserList.UserFields.AdvertisingSid = Convert.ToUInt32(value, 16);
		}
	}
}
