using System;
using QCRPG.Framework;

namespace QCRPG.TSL.BT.Packets;

public class HostSleepInfo : PacketInfoBase
{
	public override string Name => "Host Sleep";

	public override string DisplayGroup => "Vendor Specific";

	public HostSleepInfo(HostSleep packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		HostSleep hostSleep = (HostSleep)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Sleep_Level", HostSleep.UserFieldsWrapper.SleepLevelInfo.SleepLevelToDescription(), 8, FormatValue(hostSleep.UserFields.SleepLevel, 8), HostSleep.UserFieldsWrapper.SleepLevelInfo.SleepLevelToString(HostSleep.UserFieldsWrapper.SleepLevelInfo.ValueToSleepLevel(hostSleep.UserFields.SleepLevel)), "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
	}

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