using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class SetStereoModeInfo : PacketInfoBase
{
	public override string Name => "Set Stereo Mode";

	public override string DisplayGroup => "Receiver Control";

	public SetStereoModeInfo(SetStereoMode packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		SetStereoMode setStereoMode = (SetStereoMode)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Stereo Mode", SetStereoMode.UserFieldsWrapper.StereoModeInfo.StereoModeToDescription(), 8, FormatValue(setStereoMode.UserFields.StereoMode, 8), SetStereoMode.UserFieldsWrapper.StereoModeInfo.StereoModeToString(SetStereoMode.UserFieldsWrapper.StereoModeInfo.ValueToStereoMode(setStereoMode.UserFields.StereoMode)), "", "1", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Signal Blending", SetStereoMode.UserFieldsWrapper.SignalBlendingInfo.SignalBlendingToDescription(), 8, FormatValue(setStereoMode.UserFields.SignalBlending, 8), SetStereoMode.UserFieldsWrapper.SignalBlendingInfo.SignalBlendingToString(SetStereoMode.UserFieldsWrapper.SignalBlendingInfo.ValueToSignalBlending(setStereoMode.UserFields.SignalBlending)), "", "1", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Interference Blending", SetStereoMode.UserFieldsWrapper.InterferenceBlendingInfo.InterferenceBlendingToDescription(), 8, FormatValue(setStereoMode.UserFields.InterferenceBlending, 8), SetStereoMode.UserFieldsWrapper.InterferenceBlendingInfo.InterferenceBlendingToString(SetStereoMode.UserFieldsWrapper.InterferenceBlendingInfo.ValueToInterferenceBlending(setStereoMode.UserFields.InterferenceBlending)), "", "1", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Mono Stereo Switch", SetStereoMode.UserFieldsWrapper.MonoStereoSwitchInfo.MonoStereoSwitchToDescription(), 8, FormatValue(setStereoMode.UserFields.MonoStereoSwitch, 8), SetStereoMode.UserFieldsWrapper.MonoStereoSwitchInfo.MonoStereoSwitchToString(SetStereoMode.UserFieldsWrapper.MonoStereoSwitchInfo.ValueToMonoStereoSwitch(setStereoMode.UserFields.MonoStereoSwitch)), "", "1", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		SetStereoMode setStereoMode = (SetStereoMode)packet;
		int num = -1;
		if (index == ++num)
		{
			setStereoMode.UserFields.StereoMode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setStereoMode.UserFields.SignalBlending = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setStereoMode.UserFields.InterferenceBlending = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setStereoMode.UserFields.MonoStereoSwitch = Convert.ToUInt32(value, 16);
		}
	}
}
