using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeMultiAdvtSetAdvtEnableMultiInfo : PacketInfoBase
{
	public override string Name => "Le Multi Advt Set Advt Enable Multi";

	public override string DisplayGroup => "Vendor Specific";

	public LeMultiAdvtSetAdvtEnableMultiInfo(LeMultiAdvtSetAdvtEnableMulti packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeMultiAdvtSetAdvtEnableMulti leMultiAdvtSetAdvtEnableMulti = (LeMultiAdvtSetAdvtEnableMulti)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Multi_advt_opcode", "Set_Advt_Enable_Multi_Sub_Cmd", 8, FormatValue(leMultiAdvtSetAdvtEnableMulti.UserFields.MultiAdvtOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Advertising_Enable", LeMultiAdvtSetAdvtEnableMulti.UserFieldsWrapper.AdvertisingEnableInfo.AdvertisingEnableToDescription(), 8, FormatValue(leMultiAdvtSetAdvtEnableMulti.UserFields.AdvertisingEnable, 8), LeMultiAdvtSetAdvtEnableMulti.UserFieldsWrapper.AdvertisingEnableInfo.AdvertisingEnableToString(LeMultiAdvtSetAdvtEnableMulti.UserFieldsWrapper.AdvertisingEnableInfo.ValueToAdvertisingEnable(leMultiAdvtSetAdvtEnableMulti.UserFields.AdvertisingEnable)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Advertising_Instance", "Specifies the applicability of the above parameters to an instance.", 8, FormatValue(leMultiAdvtSetAdvtEnableMulti.UserFields.AdvertisingInstance, 8), "", "01", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LeMultiAdvtSetAdvtEnableMulti leMultiAdvtSetAdvtEnableMulti = (LeMultiAdvtSetAdvtEnableMulti)packet;
		int num = -1;
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field MultiAdvtOpcode");
		}
		if (index == ++num)
		{
			leMultiAdvtSetAdvtEnableMulti.UserFields.AdvertisingEnable = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leMultiAdvtSetAdvtEnableMulti.UserFields.AdvertisingInstance = Convert.ToUInt32(value, 16);
		}
	}
}
