using System;
using QCRPG.Framework;

namespace QCRPG.TSL.FMHCI.Packets;

public class SetMuteModeInfo : PacketInfoBase
{
	public override string Name => "Set Mute Mode";

	public override string DisplayGroup => "Receiver Control";

	public SetMuteModeInfo(SetMuteMode packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		SetMuteMode setMuteMode = (SetMuteMode)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Hard Mute", MuteModeInfo.MuteModeToDescription(), 8, FormatValue(setMuteMode.UserFields.HardMute, 8), MuteModeInfo.MuteModeToString(MuteModeInfo.ValueToMuteMode(setMuteMode.UserFields.HardMute)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Soft Mute", SetMuteMode.UserFieldsWrapper.SoftMuteInfo.SoftMuteToDescription(), 8, FormatValue(setMuteMode.UserFields.SoftMute, 8), SetMuteMode.UserFieldsWrapper.SoftMuteInfo.SoftMuteToString(SetMuteMode.UserFieldsWrapper.SoftMuteInfo.ValueToSoftMute(setMuteMode.UserFields.SoftMute)), "", "1", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		SetMuteMode setMuteMode = (SetMuteMode)packet;
		int num = -1;
		if (index == ++num)
		{
			setMuteMode.UserFields.HardMute = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			setMuteMode.UserFields.SoftMute = Convert.ToUInt32(value, 16);
		}
	}
}
