using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class WriteLeHostSupportInfo : PacketInfoBase
{
	public override string Name => "Write Le Host Support";

	public override string DisplayGroup => "Host Control and Baseband";

	public WriteLeHostSupportInfo(WriteLeHostSupport packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		WriteLeHostSupport writeLeHostSupport = (WriteLeHostSupport)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("LE Supported Host", WriteLeHostSupport.UserFieldsWrapper.LeSupportedHostInfo.LeSupportedHostToDescription(), 8, FormatValue(writeLeHostSupport.UserFields.LeSupportedHost, 8), WriteLeHostSupport.UserFieldsWrapper.LeSupportedHostInfo.LeSupportedHostToString(WriteLeHostSupport.UserFieldsWrapper.LeSupportedHostInfo.ValueToLeSupportedHost(writeLeHostSupport.UserFields.LeSupportedHost)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Simultaneous LE Host", WriteLeHostSupport.UserFieldsWrapper.SimultaneousLeHostInfo.SimultaneousLeHostToDescription(), 8, FormatValue(writeLeHostSupport.UserFields.SimultaneousLeHost, 8), WriteLeHostSupport.UserFieldsWrapper.SimultaneousLeHostInfo.SimultaneousLeHostToString(WriteLeHostSupport.UserFieldsWrapper.SimultaneousLeHostInfo.ValueToSimultaneousLeHost(writeLeHostSupport.UserFields.SimultaneousLeHost)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		WriteLeHostSupport writeLeHostSupport = (WriteLeHostSupport)packet;
		int num = -1;
		if (index == ++num)
		{
			writeLeHostSupport.UserFields.LeSupportedHost = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			writeLeHostSupport.UserFields.SimultaneousLeHost = Convert.ToUInt32(value, 16);
		}
	}
}
