using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class VsProfileSimulateInfo : PacketInfoBase
{
	public override string Name => "Vs Profile Simulate";

	public override string DisplayGroup => "Vendor Specific";

	public VsProfileSimulateInfo(VsProfileSimulate packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		VsProfileSimulate vsProfileSimulate = (VsProfileSimulate)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Profile", "Profile 1 = A2DP and others reserved", 8, FormatValue(vsProfileSimulate.UserFields.Profile, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("CONN Handle LSB", "CONN Handle LSB", 8, FormatValue(vsProfileSimulate.UserFields.ConnHandleLsb, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("CONN Handle MSB", "CONN Handle MSB", 8, FormatValue(vsProfileSimulate.UserFields.ConnHandleMsb, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Enable", VsProfileSimulate.UserFieldsWrapper.EnableInfo.EnableToDescription(), 8, FormatValue(vsProfileSimulate.UserFields.Enable, 8), VsProfileSimulate.UserFieldsWrapper.EnableInfo.EnableToString(VsProfileSimulate.UserFieldsWrapper.EnableInfo.ValueToEnable(vsProfileSimulate.UserFields.Enable)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		VsProfileSimulate vsProfileSimulate = (VsProfileSimulate)packet;
		int num = -1;
		if (index == ++num)
		{
			vsProfileSimulate.UserFields.Profile = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			vsProfileSimulate.UserFields.ConnHandleLsb = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			vsProfileSimulate.UserFields.ConnHandleMsb = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			vsProfileSimulate.UserFields.Enable = Convert.ToUInt32(value, 16);
		}
	}
}
