using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class SetTriggeredClockCaptureInfo : PacketInfoBase
{
	public override string Name => "Set Triggered Clock Capture";

	public override string DisplayGroup => "Status Parameters";

	public SetTriggeredClockCaptureInfo(SetTriggeredClockCapture packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		SetTriggeredClockCapture setTriggeredClockCapture = (SetTriggeredClockCapture)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Connection_Handle", "Connection Handle to be used to identify a connection.. Range: 0x0000-0x0EFF (0x0F00 - 0x0FFF Reserved for future use)", 16, FormatValue(setTriggeredClockCapture.UserFields.ConnectionHandle, 16), "", "0000", "0EFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Enable", SetTriggeredClockCapture.UserFieldsWrapper.EnableInfo.EnableToDescription(), 8, FormatValue(setTriggeredClockCapture.UserFields.Enable, 8), SetTriggeredClockCapture.UserFieldsWrapper.EnableInfo.EnableToString(SetTriggeredClockCapture.UserFieldsWrapper.EnableInfo.ValueToEnable(setTriggeredClockCapture.UserFields.Enable)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Which_Clock", SetTriggeredClockCapture.UserFieldsWrapper.WhichClockInfo.WhichClockToDescription(), 8, FormatValue(setTriggeredClockCapture.UserFields.WhichClock, 8), SetTriggeredClockCapture.UserFieldsWrapper.WhichClockInfo.WhichClockToString(SetTriggeredClockCapture.UserFieldsWrapper.WhichClockInfo.ValueToWhichClock(setTriggeredClockCapture.UserFields.WhichClock)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("LPO_Allowed", SetTriggeredClockCapture.UserFieldsWrapper.LpoAllowedInfo.LpoAllowedToDescription(), 8, FormatValue(setTriggeredClockCapture.UserFields.LpoAllowed, 8), SetTriggeredClockCapture.UserFieldsWrapper.LpoAllowedInfo.LpoAllowedToString(SetTriggeredClockCapture.UserFieldsWrapper.LpoAllowedInfo.ValueToLpoAllowed(setTriggeredClockCapture.UserFields.LpoAllowed)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Num_Clock_Captures_To_Filter", SetTriggeredClockCapture.UserFieldsWrapper.NumClockCapturesToFilterInfo.NumClockCapturesToFilterToDescription(), 8, FormatValue(setTriggeredClockCapture.UserFields.NumClockCapturesToFilter, 8), SetTriggeredClockCapture.UserFieldsWrapper.NumClockCapturesToFilterInfo.NumClockCapturesToFilterToString(SetTriggeredClockCapture.UserFieldsWrapper.NumClockCapturesToFilterInfo.ValueToNumClockCapturesToFilter(setTriggeredClockCapture.UserFields.NumClockCapturesToFilter)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		SetTriggeredClockCapture setTriggeredClockCapture = (SetTriggeredClockCapture)packet;
		int num = -1;
		if (index == ++num)
		{
			setTriggeredClockCapture.UserFields.ConnectionHandle = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setTriggeredClockCapture.UserFields.Enable = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setTriggeredClockCapture.UserFields.WhichClock = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setTriggeredClockCapture.UserFields.LpoAllowed = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setTriggeredClockCapture.UserFields.NumClockCapturesToFilter = Convert.ToUInt32(value, 16);
		}
	}
}
