using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class A2dpStopA2dpMediaInfo : PacketInfoBase
{
	public override string Name => "A2dp Stop A2dp Media";

	public override string DisplayGroup => "Vendor Specific";

	public A2dpStopA2dpMediaInfo(A2dpStopA2dpMedia packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		A2dpStopA2dpMedia a2dpStopA2dpMedia = (A2dpStopA2dpMedia)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sub OpCode", "", 8, FormatValue(a2dpStopA2dpMedia.UserFields.SubOpcode, 8), "", "", "", settable: false, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Handle", "Handle", 8, FormatValue(a2dpStopA2dpMedia.UserFields.Handle, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		A2dpStopA2dpMedia a2dpStopA2dpMedia = (A2dpStopA2dpMedia)packet;
		int num = -1;
		if (index == ++num)
		{
			throw new Exception("Tried to set non-settable field SubOpcode");
		}
		if (index == ++num)
		{
			a2dpStopA2dpMedia.UserFields.Handle = Convert.ToUInt32(value, 16);
		}
	}
}
