using System.Text.Json.Serialization; using Questionable.Model.Questing.Converter; namespace Questionable.Model.Questing; [JsonConverter(typeof(QuestWorkConfigConverter))] public sealed class QuestWorkValue(byte? high, byte? low, EQuestWorkMode mode) { public byte? High { get; set; } = high; public byte? Low { get; set; } = low; public EQuestWorkMode Mode { get; set; } = mode; public QuestWorkValue(byte value) : this((byte)(value >> 4), (byte)(value & 0xF), EQuestWorkMode.Bitwise) { } public override string ToString() { if (High.HasValue && Low.HasValue) { return ((byte)(High << 4).Value + Low).ToString(); } if (High.HasValue) { return High + "H"; } if (Low.HasValue) { return Low + "L"; } return "-"; } }