using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class WriteHoldModeActivityInfo : PacketInfoBase
{
	public override string Name => "Write Hold Mode Activity";

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

	public WriteHoldModeActivityInfo(WriteHoldModeActivity packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		WriteHoldModeActivity writeHoldModeActivity = (WriteHoldModeActivity)packet;
		fieldInfoList.Clear();
		if (writeHoldModeActivity.UserFields.HoldModeActivity == 0)
		{
			fieldInfoList.Add(new PacketFieldInfo("Hold Mode Activity", DefaultHoldModeActivityInfo.DefaultHoldModeActivityToDescription(), 8, FormatValue(writeHoldModeActivity.UserFields.HoldModeActivity, 8), DefaultHoldModeActivityInfo.DefaultHoldModeActivityToString(DefaultHoldModeActivityInfo.ValueToDefaultHoldModeActivity(writeHoldModeActivity.UserFields.HoldModeActivity)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		}
		else if (writeHoldModeActivity.UserFields.HoldModeActivity >= 1 && writeHoldModeActivity.UserFields.HoldModeActivity <= 255)
		{
			fieldInfoList.Add(new PacketFieldInfo("Hold Mode Activity", SuspendHoldModeActivityInfo.SuspendHoldModeActivityToDescription(), 8, FormatValue(writeHoldModeActivity.UserFields.HoldModeActivity, 8), SuspendHoldModeActivityInfo.SuspendHoldModeActivityToString(SuspendHoldModeActivityInfo.ValueToSuspendHoldModeActivity(writeHoldModeActivity.UserFields.HoldModeActivity)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		}
		else
		{
			fieldInfoList.Add(new PacketFieldInfo("Hold Mode Activity", "", 8, FormatValue(writeHoldModeActivity.UserFields.HoldModeActivity, 8), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		}
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		WriteHoldModeActivity writeHoldModeActivity = (WriteHoldModeActivity)packet;
		int num = -1;
		if (index == ++num)
		{
			writeHoldModeActivity.UserFields.HoldModeActivity = Convert.ToUInt32(value, 16);
		}
	}
}
