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

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

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