using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class QbceSetQhsHostModeInfo : PacketInfoBase
{
	public override string Name => "Qbce Set Qhs Host Mode";

	public override string DisplayGroup => "Vendor Specific";

	public QbceSetQhsHostModeInfo(QbceSetQhsHostMode packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		QbceSetQhsHostMode qbceSetQhsHostMode = (QbceSetQhsHostMode)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Subopcode", "HCI_VS_SET_QHS_HOST_MODE", 8, FormatValue(qbceSetQhsHostMode.UserFields.Subopcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Transport", QbceSetQhsHostMode.UserFieldsWrapper.TransportInfo.TransportToDescription(), 8, FormatValue(qbceSetQhsHostMode.UserFields.Transport, 8), QbceSetQhsHostMode.UserFieldsWrapper.TransportInfo.TransportToString(QbceSetQhsHostMode.UserFieldsWrapper.TransportInfo.ValueToTransport(qbceSetQhsHostMode.UserFields.Transport)), "0", "2", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("QHS_host_mode", QbceSetQhsHostMode.UserFieldsWrapper.QhsHostModeInfo.QhsHostModeToDescription(), 8, FormatValue(qbceSetQhsHostMode.UserFields.QhsHostMode, 8), QbceSetQhsHostMode.UserFieldsWrapper.QhsHostModeInfo.QhsHostModeToString(QbceSetQhsHostMode.UserFieldsWrapper.QhsHostModeInfo.ValueToQhsHostMode(qbceSetQhsHostMode.UserFields.QhsHostMode)), "0", "3", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		QbceSetQhsHostMode qbceSetQhsHostMode = (QbceSetQhsHostMode)packet;
		int num = -1;
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field Subopcode");
		}
		if (index == ++num)
		{
			qbceSetQhsHostMode.UserFields.Transport = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			qbceSetQhsHostMode.UserFields.QhsHostMode = Convert.ToUInt32(value, 16);
		}
	}
}
