using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class SetDcCalibrationDataInfo : PacketInfoBase
{
	public override string Name => "Set Dc Calibration Data";

	public override string DisplayGroup => "Common Control";

	public SetDcCalibrationDataInfo(SetDcCalibrationData packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		SetDcCalibrationData setDcCalibrationData = (SetDcCalibrationData)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Mode", "", 8, FormatValue(setDcCalibrationData.UserFields.Mode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_LO_I 0", "The RX_DCC_I_0 register corresponds to low LO LNA GAIN value 00 (RX_DCC_I_0)", 24, FormatValue(setDcCalibrationData.UserFields.DccLoI0, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_LO_I 1", "The RX_DCC_I_1 register corresponds to low LO LNA GAIN value 01 (RX_DCC_I_1)", 24, FormatValue(setDcCalibrationData.UserFields.DccLoI1, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_LO_I 2", "The RX_DCC_I_2 register corresponds to low LO LNA GAIN value 10 (RX_DCC_I_2)", 24, FormatValue(setDcCalibrationData.UserFields.DccLoI2, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_LO_I 3", "The RX_DCC_I_3 register corresponds to low LO LNA GAIN value 11 (RX_DCC_I_3)", 24, FormatValue(setDcCalibrationData.UserFields.DccLoI3, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_LO_Q 0", "The RX_DCC_Q_0 register corresponds to low LO LNA GAIN value 00 (RX_DCC_Q_0)", 24, FormatValue(setDcCalibrationData.UserFields.DccLoQ0, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_LO_Q 1", "The RX_DCC_Q_1 register corresponds to low LO LNA GAIN value 01 (RX_DCC_Q_1)", 24, FormatValue(setDcCalibrationData.UserFields.DccLoQ1, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_LO_Q 2", "The RX_DCC_Q_2 register corresponds to low LO LNA GAIN value 10 (RX_DCC_Q_2)", 24, FormatValue(setDcCalibrationData.UserFields.DccLoQ2, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_LO_Q 3", "The RX_DCC_Q_3 register corresponds to low LO LNA GAIN value 11 (RX_DCC_Q_3)", 24, FormatValue(setDcCalibrationData.UserFields.DccLoQ3, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_HI_I 0", "The RX_DCC_I_0 register corresponds to high LO LNA GAIN value 00 (RX_DCC_I_0)", 24, FormatValue(setDcCalibrationData.UserFields.DccHiI0, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_HI_I 1", "The RX_DCC_I_1 register corresponds to high LO LNA GAIN value 01 (RX_DCC_I_1)", 24, FormatValue(setDcCalibrationData.UserFields.DccHiI1, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_HI_I 2", "The RX_DCC_I_2 register corresponds to high LO LNA GAIN value 10 (RX_DCC_I_2)", 24, FormatValue(setDcCalibrationData.UserFields.DccHiI2, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_HI_I 3", "The RX_DCC_I_3 register corresponds to high LO LNA GAIN value 11 (RX_DCC_I_3)", 24, FormatValue(setDcCalibrationData.UserFields.DccHiI3, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_HI_Q 0", "The RX_DCC_Q_0 register corresponds to high LO LNA GAIN value 00 (RX_DCC_Q_0)", 24, FormatValue(setDcCalibrationData.UserFields.DccHiQ0, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_HI_Q 1", "The RX_DCC_Q_1 register corresponds to high LO LNA GAIN value 01 (RX_DCC_Q_1)", 24, FormatValue(setDcCalibrationData.UserFields.DccHiQ1, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_HI_Q 2", "The RX_DCC_Q_2 register corresponds to high LO LNA GAIN value 10 (RX_DCC_Q_2)", 24, FormatValue(setDcCalibrationData.UserFields.DccHiQ2, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("DCC_HI_Q 3", "The RX_DCC_Q_3 register corresponds to high LO LNA GAIN value 11 (RX_DCC_Q_3)", 24, FormatValue(setDcCalibrationData.UserFields.DccHiQ3, 24), "", "", "3FFFFF", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		SetDcCalibrationData setDcCalibrationData = (SetDcCalibrationData)packet;
		int num = -1;
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field Mode");
		}
		if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccLoI0 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccLoI1 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccLoI2 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccLoI3 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccLoQ0 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccLoQ1 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccLoQ2 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccLoQ3 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccHiI0 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccHiI1 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccHiI2 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccHiI3 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccHiQ0 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccHiQ1 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccHiQ2 = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setDcCalibrationData.UserFields.DccHiQ3 = Convert.ToUInt32(value, 16);
		}
	}
}
