using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class StereoStatusInfo : PacketInfoBase
{
	public override string Name => "Stereo Status";

	public override string DisplayGroup => "Events";

	public StereoStatusInfo(StereoStatus packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		StereoStatus stereoStatus = (StereoStatus)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Pilot PLL Lock Indicator", "", 1, FormatValue(stereoStatus.UserFields.PilotPllLockIndicator, 1), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Hard Mute Right-Channel Indicator", "", 1, FormatValue(stereoStatus.UserFields.HardMuteRightChannelIndicator, 1), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Hard Mute Left-Channel Indicator", "", 1, FormatValue(stereoStatus.UserFields.HardMuteLeftChannelIndicator, 1), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Interference Mitigated Soft Mute Indicator", "", 1, FormatValue(stereoStatus.UserFields.InterferenceMitigatedSoftMuteIndicator, 1), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Interference Mitigated Blending Indicator", "", 1, FormatValue(stereoStatus.UserFields.InterferenceMitigatedBlendingIndicator, 1), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Soft Mute Indicator", "", 1, FormatValue(stereoStatus.UserFields.SoftMuteIndicator, 1), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Blending On Indicator", "", 1, FormatValue(stereoStatus.UserFields.BlendingOnIndicator, 1), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Stereo Indicator", StereoStatus.UserFieldsWrapper.StereoIndicatorInfo.StereoIndicatorToDescription(), 1, FormatValue(stereoStatus.UserFields.StereoIndicator, 1), StereoStatus.UserFieldsWrapper.StereoIndicatorInfo.StereoIndicatorToString(StereoStatus.UserFieldsWrapper.StereoIndicatorInfo.ValueToStereoIndicator(stereoStatus.UserFields.StereoIndicator)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		StereoStatus stereoStatus = (StereoStatus)packet;
		int num = -1;
		if (index == ++num)
		{
			stereoStatus.UserFields.PilotPllLockIndicator = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			stereoStatus.UserFields.HardMuteRightChannelIndicator = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			stereoStatus.UserFields.HardMuteLeftChannelIndicator = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			stereoStatus.UserFields.InterferenceMitigatedSoftMuteIndicator = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			stereoStatus.UserFields.InterferenceMitigatedBlendingIndicator = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			stereoStatus.UserFields.SoftMuteIndicator = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			stereoStatus.UserFields.BlendingOnIndicator = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			stereoStatus.UserFields.StereoIndicator = Convert.ToUInt32(value, 16);
		}
	}
}
