using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class LeBatchScanSetBatchScanStorageParamInfo : PacketInfoBase
{
	public override string Name => "Le Batch Scan Set Batch Scan Storage Param";

	public override string DisplayGroup => "Vendor Specific";

	public LeBatchScanSetBatchScanStorageParamInfo(LeBatchScanSetBatchScanStorageParam packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		LeBatchScanSetBatchScanStorageParam leBatchScanSetBatchScanStorageParam = (LeBatchScanSetBatchScanStorageParam)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Batch_Scan_opcode", "Set Batch Scan Storage Parameters", 8, FormatValue(leBatchScanSetBatchScanStorageParam.UserFields.BatchScanOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Batch_Scan_Full_Max", "Max storage space (in %) allocated to full style [Range : 0-100]", 8, FormatValue(leBatchScanSetBatchScanStorageParam.UserFields.BatchScanFullMax, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Batch_Scan_Truncated_Max", "Max storage space (in %) allocated to truncated style [Range : 0-100]", 8, FormatValue(leBatchScanSetBatchScanStorageParam.UserFields.BatchScanTruncatedMax, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Batch_Scan_Notify_Threshold", "Setup notification level(in %) for individual storage pool [Range: 0-100], Setting it 0 will disable notification. Vendor specific HCI event is generated(Storage threshold breach sub event)", 8, FormatValue(leBatchScanSetBatchScanStorageParam.UserFields.BatchScanNotifyThreshold, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		LeBatchScanSetBatchScanStorageParam leBatchScanSetBatchScanStorageParam = (LeBatchScanSetBatchScanStorageParam)packet;
		int num = -1;
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field BatchScanOpcode");
		}
		if (index == ++num)
		{
			leBatchScanSetBatchScanStorageParam.UserFields.BatchScanFullMax = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leBatchScanSetBatchScanStorageParam.UserFields.BatchScanTruncatedMax = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			leBatchScanSetBatchScanStorageParam.UserFields.BatchScanNotifyThreshold = Convert.ToUInt32(value, 16);
		}
	}
}
