public enum AuthAuditEventType
{
    UserLogout,
    TokenRefreshed
}

public static class AuthAuditEventTypeExtensions
{
    public static string ToDbString(this AuthAuditEventType t) => t switch
    {
        AuthAuditEventType.UserLogout     => "USER_LOGOUT",
        AuthAuditEventType.TokenRefreshed => "TOKEN_REFRESHED",
        _ => throw new ArgumentOutOfRangeException(nameof(t))
    };

    public static AuthAuditEventType FromDbString(string v) => v switch
    {
        "USER_LOGOUT"     => AuthAuditEventType.UserLogout,
        "TOKEN_REFRESHED" => AuthAuditEventType.TokenRefreshed,
        _ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown auth audit event type: '{v}'")
    };
}
