using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; using StabilityMatrix.Core.Converters.Json; namespace StabilityMatrix.Core.Models.Settings; /// /// Notification Names /// [SuppressMessage("ReSharper", "InconsistentNaming")] [JsonConverter(typeof(ParsableStringValueJsonConverter))] public record NotificationKey(string Value) : StringValue(Value), IParsable { public NotificationOption DefaultOption { get; init; } public NotificationLevel Level { get; init; } public string? DisplayName { get; init; } public static NotificationKey Inference_PromptCompleted => new("Inference_PromptCompleted") { DefaultOption = NotificationOption.NativePush, Level = NotificationLevel.Success, DisplayName = "Inference Prompt Completed" }; public static NotificationKey Download_Completed => new("Download_Completed") { DefaultOption = NotificationOption.NativePush, Level = NotificationLevel.Success, DisplayName = "Download Completed" }; public static NotificationKey Download_Failed => new("Download_Failed") { DefaultOption = NotificationOption.NativePush, Level = NotificationLevel.Error, DisplayName = "Download Failed" }; public static NotificationKey Download_Canceled => new("Download_Canceled") { DefaultOption = NotificationOption.NativePush, Level = NotificationLevel.Warning, DisplayName = "Download Canceled" }; public static NotificationKey Package_Install_Completed => new("Package_Install_Completed") { DefaultOption = NotificationOption.NativePush, Level = NotificationLevel.Success, DisplayName = "Package Install Completed" }; public static NotificationKey Package_Install_Failed => new("Package_Install_Failed") { DefaultOption = NotificationOption.NativePush, Level = NotificationLevel.Error, DisplayName = "Package Install Failed" }; public static Dictionary All { get; } = GetValues(); /// public override string ToString() => base.ToString(); /// public static NotificationKey Parse(string s, IFormatProvider? provider) { return All[s]; } /// public static bool TryParse( string? s, IFormatProvider? provider, [MaybeNullWhen(false)] out NotificationKey result ) { return All.TryGetValue(s ?? "", out result); } }