using System; using CommunityToolkit.Mvvm.ComponentModel; namespace ThreadPilot.Models { /// /// Model representing a notification /// public partial class NotificationModel : ObservableObject { [ObservableProperty] private string id = Guid.NewGuid().ToString(); [ObservableProperty] private string title = string.Empty; [ObservableProperty] private string message = string.Empty; [ObservableProperty] private NotificationType type = NotificationType.Information; [ObservableProperty] private DateTime timestamp = DateTime.Now; [ObservableProperty] private int durationMs = 3000; [ObservableProperty] private bool isRead = false; [ObservableProperty] private bool isPersistent = false; [ObservableProperty] private string? actionText; [ObservableProperty] private string? actionCommand; [ObservableProperty] private string? iconPath; [ObservableProperty] private NotificationPriority priority = NotificationPriority.Normal; [ObservableProperty] private string? category; [ObservableProperty] private string? sourceService; /// /// Creates a new notification /// public NotificationModel() { } /// /// Creates a new notification with basic information /// public NotificationModel(string title, string message, NotificationType type = NotificationType.Information) { Title = title; Message = message; Type = type; } /// /// Creates a new notification with full information /// public NotificationModel(string title, string message, NotificationType type, int durationMs, bool isPersistent = false) { Title = title; Message = message; Type = type; DurationMs = durationMs; IsPersistent = isPersistent; } /// /// Marks the notification as read /// public void MarkAsRead() { IsRead = true; } /// /// Gets the display text for the notification type /// public string TypeDisplayText => Type switch { NotificationType.Information => "Info", NotificationType.Success => "Success", NotificationType.Warning => "Warning", NotificationType.Error => "Error", NotificationType.PowerPlanChange => "Power Plan", NotificationType.ProcessMonitoring => "Process Monitor", NotificationType.CpuAffinity => "CPU Affinity", _ => "Unknown" }; /// /// Gets the formatted timestamp /// public string FormattedTimestamp => Timestamp.ToString("HH:mm:ss"); /// /// Gets the formatted date and time /// public string FormattedDateTime => Timestamp.ToString("yyyy-MM-dd HH:mm:ss"); } /// /// Types of notifications /// public enum NotificationType { Information, Success, Warning, Error, PowerPlanChange, ProcessMonitoring, CpuAffinity } /// /// Notification priority levels /// public enum NotificationPriority { Low, Normal, High, Critical } }