using System;
using QCRPG.Framework;

namespace QCRPG.TSL.ZigBee.Packets;

public class PlatformDisableUartInfo : PacketInfoBase
{
	public override string Name => "Platform Disable Uart";

	public override string DisplayGroup => "Vendor Specific Packets";

	public PlatformDisableUartInfo(PlatformDisableUart packet)
		: base(packet)
	{
		UpdateFieldInfoFromPacket();
	}

	public override void UpdateFieldInfoFromPacket()
	{
		PlatformDisableUart platformDisableUart = (PlatformDisableUart)packet;
		fieldInfoList.Clear();
		fieldInfoList.Add(new PacketFieldInfo("Flags", "Flags", 32, FormatValue(platformDisableUart.UserFields.Flags, 32), "", "", "", settable: true, littleEndianTransport: false, omitFromTransport: false, DataEntryMode.RightAlignedHex));
		fieldInfoList.Add(new PacketFieldInfo("Time", "Time to turn off UART in milliseconds. 0xFFFFFFFF to turn off indefinitely", 32, FormatValue(platformDisableUart.UserFields.Time, 32), "", "", "", settable: true, littleEndianTransport: true, omitFromTransport: false, DataEntryMode.DecimalInteger));
	}

	public override void UpdatePacketFromFieldInfo(int index, string value)
	{
		PlatformDisableUart platformDisableUart = (PlatformDisableUart)packet;
		int num = -1;
		if (index == ++num)
		{
			platformDisableUart.UserFields.Flags = Convert.ToUInt32(value, 16);
		}
		else if (index == ++num)
		{
			platformDisableUart.UserFields.Time = Convert.ToUInt32(value, 16);
		}
	}
}
