using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class SetHiLoInjectionInfo : PacketInfoBase
{
	public override string Name => "Set Hi Lo Injection";

	public override string DisplayGroup => "Receiver Control";

	public SetHiLoInjectionInfo(SetHiLoInjection packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		SetHiLoInjection setHiLoInjection = (SetHiLoInjection)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Frequency Count", "This will indicate how many frequencies are meaningful, i.e., 3 means Frequency 0 to Frequency 2 (3 frequencies) are meaningful.", 8, FormatValue(setHiLoInjection.UserFields.FrequencyCount, 8), "", "", "A", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Frequency 0", "Frequency in kHz", 24, FormatValue(setHiLoInjection.UserFields.Frequency0, 24), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.DecimalInteger));
		fieldInfoList.Add(new PacketFieldInfo("Injection Side 0", InjectionSideInfo.InjectionSideToDescription(), 8, FormatValue(setHiLoInjection.UserFields.InjectionSide0, 8), InjectionSideInfo.InjectionSideToString(InjectionSideInfo.ValueToInjectionSide(setHiLoInjection.UserFields.InjectionSide0)), "", "2", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Frequency 1", "Frequency in kHz", 24, FormatValue(setHiLoInjection.UserFields.Frequency1, 24), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.DecimalInteger));
		fieldInfoList.Add(new PacketFieldInfo("Injection Side 1", InjectionSideInfo.InjectionSideToDescription(), 8, FormatValue(setHiLoInjection.UserFields.InjectionSide1, 8), InjectionSideInfo.InjectionSideToString(InjectionSideInfo.ValueToInjectionSide(setHiLoInjection.UserFields.InjectionSide1)), "", "2", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Frequency 2", "Frequency in kHz", 24, FormatValue(setHiLoInjection.UserFields.Frequency2, 24), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.DecimalInteger));
		fieldInfoList.Add(new PacketFieldInfo("Injection Side 2", InjectionSideInfo.InjectionSideToDescription(), 8, FormatValue(setHiLoInjection.UserFields.InjectionSide2, 8), InjectionSideInfo.InjectionSideToString(InjectionSideInfo.ValueToInjectionSide(setHiLoInjection.UserFields.InjectionSide2)), "", "2", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Frequency 3", "Frequency in kHz", 24, FormatValue(setHiLoInjection.UserFields.Frequency3, 24), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.DecimalInteger));
		fieldInfoList.Add(new PacketFieldInfo("Injection Side 3", InjectionSideInfo.InjectionSideToDescription(), 8, FormatValue(setHiLoInjection.UserFields.InjectionSide3, 8), InjectionSideInfo.InjectionSideToString(InjectionSideInfo.ValueToInjectionSide(setHiLoInjection.UserFields.InjectionSide3)), "", "2", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Frequency 4", "Frequency in kHz", 24, FormatValue(setHiLoInjection.UserFields.Frequency4, 24), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.DecimalInteger));
		fieldInfoList.Add(new PacketFieldInfo("Injection Side 4", InjectionSideInfo.InjectionSideToDescription(), 8, FormatValue(setHiLoInjection.UserFields.InjectionSide4, 8), InjectionSideInfo.InjectionSideToString(InjectionSideInfo.ValueToInjectionSide(setHiLoInjection.UserFields.InjectionSide4)), "", "2", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Frequency 5", "Frequency in kHz", 24, FormatValue(setHiLoInjection.UserFields.Frequency5, 24), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.DecimalInteger));
		fieldInfoList.Add(new PacketFieldInfo("Injection Side 5", InjectionSideInfo.InjectionSideToDescription(), 8, FormatValue(setHiLoInjection.UserFields.InjectionSide5, 8), InjectionSideInfo.InjectionSideToString(InjectionSideInfo.ValueToInjectionSide(setHiLoInjection.UserFields.InjectionSide5)), "", "2", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Frequency 6", "Frequency in kHz", 24, FormatValue(setHiLoInjection.UserFields.Frequency6, 24), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.DecimalInteger));
		fieldInfoList.Add(new PacketFieldInfo("Injection Side 6", InjectionSideInfo.InjectionSideToDescription(), 8, FormatValue(setHiLoInjection.UserFields.InjectionSide6, 8), InjectionSideInfo.InjectionSideToString(InjectionSideInfo.ValueToInjectionSide(setHiLoInjection.UserFields.InjectionSide6)), "", "2", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Frequency 7", "Frequency in kHz", 24, FormatValue(setHiLoInjection.UserFields.Frequency7, 24), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.DecimalInteger));
		fieldInfoList.Add(new PacketFieldInfo("Injection Side 7", InjectionSideInfo.InjectionSideToDescription(), 8, FormatValue(setHiLoInjection.UserFields.InjectionSide7, 8), InjectionSideInfo.InjectionSideToString(InjectionSideInfo.ValueToInjectionSide(setHiLoInjection.UserFields.InjectionSide7)), "", "2", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Frequency 8", "Frequency in kHz", 24, FormatValue(setHiLoInjection.UserFields.Frequency8, 24), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.DecimalInteger));
		fieldInfoList.Add(new PacketFieldInfo("Injection Side 8", InjectionSideInfo.InjectionSideToDescription(), 8, FormatValue(setHiLoInjection.UserFields.InjectionSide8, 8), InjectionSideInfo.InjectionSideToString(InjectionSideInfo.ValueToInjectionSide(setHiLoInjection.UserFields.InjectionSide8)), "", "2", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Frequency 9", "Frequency in kHz", 24, FormatValue(setHiLoInjection.UserFields.Frequency9, 24), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.DecimalInteger));
		fieldInfoList.Add(new PacketFieldInfo("Injection Side 9", InjectionSideInfo.InjectionSideToDescription(), 8, FormatValue(setHiLoInjection.UserFields.InjectionSide9, 8), InjectionSideInfo.InjectionSideToString(InjectionSideInfo.ValueToInjectionSide(setHiLoInjection.UserFields.InjectionSide9)), "", "2", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		SetHiLoInjection setHiLoInjection = (SetHiLoInjection)packet;
		int num = -1;
		if (index == ++num)
		{
			setHiLoInjection.UserFields.FrequencyCount = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.Frequency0 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.InjectionSide0 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.Frequency1 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.InjectionSide1 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.Frequency2 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.InjectionSide2 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.Frequency3 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.InjectionSide3 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.Frequency4 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.InjectionSide4 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.Frequency5 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.InjectionSide5 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.Frequency6 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.InjectionSide6 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.Frequency7 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.InjectionSide7 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.Frequency8 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.InjectionSide8 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.Frequency9 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setHiLoInjection.UserFields.InjectionSide9 = Convert.ToUInt32(value, 16);
		}
	}
}
