public enum OrderStatus { Pending, InProgress, Resulted, Cancelled }

public static class OrderStatusExtensions
{
    public static string ToDbString(this OrderStatus s) => s switch
    {
        OrderStatus.Pending    => "PENDING",
        OrderStatus.InProgress => "IN_PROGRESS",
        OrderStatus.Resulted   => "RESULTED",
        OrderStatus.Cancelled  => "CANCELLED",
        _ => throw new ArgumentOutOfRangeException(nameof(s))
    };

    public static OrderStatus FromDbString(string v) => v switch
    {
        "PENDING"     => OrderStatus.Pending,
        "IN_PROGRESS" => OrderStatus.InProgress,
        "RESULTED"    => OrderStatus.Resulted,
        "CANCELLED"   => OrderStatus.Cancelled,
        _ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown order status: '{v}'")
    };
}
