| | | 1 | | #region Usings |
| | | 2 | | using System.Text.Json.Serialization; |
| | | 3 | | #endregion |
| | | 4 | | |
| | | 5 | | namespace ZhEaIsNsAaBn.Utilities; |
| | | 6 | | |
| | | 7 | | /// <summary>How serious an <see cref="Error"/> is. Compared by <see cref="Value"/>.</summary> |
| | | 8 | | public sealed record Severity |
| | | 9 | | { |
| | | 10 | | /// <summary>Serious; needs attention.</summary> |
| | 42 | 11 | | public static readonly Severity High = new( nameof( High ) ); |
| | | 12 | | |
| | | 13 | | /// <summary>Minor.</summary> |
| | 42 | 14 | | public static readonly Severity Low = new( nameof( Low ) ); |
| | | 15 | | |
| | | 16 | | /// <summary>Normal; the default for new errors.</summary> |
| | 42 | 17 | | public static readonly Severity Medium = new( nameof( Medium ) ); |
| | | 18 | | |
| | | 19 | | /// <summary>Not set. <see cref="Value"/> is an empty string.</summary> |
| | 42 | 20 | | public static readonly Severity Unknown = new( string.Empty ); |
| | | 21 | | |
| | | 22 | | |
| | | 23 | | [ JsonConstructor ] |
| | 344 | 24 | | private Severity( string value ) => Value = value; |
| | | 25 | | |
| | | 26 | | |
| | | 27 | | /// <summary>The severity name: <c>High</c>, <c>Medium</c>, <c>Low</c>, or empty for <see cref="Unknown"/>.</summary |
| | | 28 | | public string Value { get; init; } |
| | | 29 | | |
| | | 30 | | |
| | | 31 | | /// <summary>Gets the severity name.</summary> |
| | | 32 | | /// <param name="value">Receives <see cref="Value"/>.</param> |
| | 0 | 33 | | public void Deconstruct( out string value ) => value = Value; |
| | | 34 | | } |