public enum BufferedSyncItemType { Observation, Alert, Ack, Resolve }

public static class BufferedSyncItemTypeExtensions
{
    public static string ToDbString(this BufferedSyncItemType t) => t switch
    {
        BufferedSyncItemType.Observation => "OBSERVATION",
        BufferedSyncItemType.Alert       => "ALERT",
        BufferedSyncItemType.Ack         => "ACK",
        BufferedSyncItemType.Resolve     => "RESOLVE",
        _ => throw new ArgumentOutOfRangeException(nameof(t))
    };

    public static BufferedSyncItemType FromDbString(string v) => v switch
    {
        "OBSERVATION" => BufferedSyncItemType.Observation,
        "ALERT"       => BufferedSyncItemType.Alert,
        "ACK"         => BufferedSyncItemType.Ack,
        "RESOLVE"     => BufferedSyncItemType.Resolve,
        _ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown buffered sync item type: '{v}'")
    };
}
