using System.Text.Json;
using System.Text.Json.Serialization;

public sealed class AlertTypeJsonConverter : JsonConverter<AlertType>
{
    public override AlertType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
        => DbStringEnumJson.Read(ref reader, AlertTypeExtensions.FromDbString);

    public override void Write(Utf8JsonWriter writer, AlertType value, JsonSerializerOptions options)
        => writer.WriteStringValue(value.ToDbString());
}
