using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; public enum LogEntryType { VideoStarted, VideoFinished, Bell, Started, Unknown } public class LogEntry { public long Time {get;set;} [JsonIgnore] public DateTimeOffset DateTime => DateTimeOffset.FromUnixTimeSeconds(Time); public string Type {get;set;}=""; [JsonIgnore] public LogEntryType EventType { get { if(Enum.TryParse(Type,out var type)) { return type; } return LogEntryType.Unknown; } set => Type = value.ToString(); } public string? VideoTitle {get;set;} public string? VideoId {get;set;} public string? ChannelTitle {get;set;} public string? ChannelId {get;set;} [JsonIgnore] [MemberNotNullWhen(true,nameof(VideoTitle),nameof(VideoId),nameof(ChannelTitle),nameof(ChannelId))] public bool HasStrings => !string.IsNullOrEmpty(VideoTitle) && !string.IsNullOrEmpty(VideoId) && !string.IsNullOrEmpty(ChannelTitle) && !string.IsNullOrEmpty(ChannelId); }