using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class VsVoiceLoopbackInfo : PacketInfoBase
{
	public override string Name => "Vs Voice Loopback";

	public override string DisplayGroup => "Vendor Specific";

	public VsVoiceLoopbackInfo(VsVoiceLoopback packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		VsVoiceLoopback vsVoiceLoopback = (VsVoiceLoopback)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Mode", "Loopback Mode\r\n\r\n" + VoiceLoopbackModeInfo.VoiceLoopbackModeToDescription(), 8, FormatValue(vsVoiceLoopback.UserFields.Mode, 8), VoiceLoopbackModeInfo.VoiceLoopbackModeToString(VoiceLoopbackModeInfo.ValueToVoiceLoopbackMode(vsVoiceLoopback.UserFields.Mode)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Voice Setting", VoiceSettingMapInfo.VoiceSettingMapToDescription(), 16, FormatValue(vsVoiceLoopback.UserFields.VoiceSetting, 16), VoiceSettingMapInfo.VoiceSettingMapToString(VoiceSettingMapInfo.ValueToVoiceSettingMap(vsVoiceLoopback.UserFields.VoiceSetting)), "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		VsVoiceLoopback vsVoiceLoopback = (VsVoiceLoopback)packet;
		int num = -1;
		if (index == ++num)
		{
			vsVoiceLoopback.UserFields.Mode = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			vsVoiceLoopback.UserFields.VoiceSetting = Convert.ToUInt32(value, 16);
		}
	}
}
