* Extended functionalities
* Added different UIs
This commit is contained in:
41
MealPlan.Api/Models/DietEnums.cs
Normal file
41
MealPlan.Api/Models/DietEnums.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
namespace MealPlan.Api.Models;
|
||||
|
||||
/// <summary>Meal slot when logging consumption. Extends recipe categories with snack.</summary>
|
||||
public enum ConsumptionMealCategory
|
||||
{
|
||||
Breakfast = 0,
|
||||
SecondBreakfast = 1,
|
||||
Lunch = 2,
|
||||
Dinner = 3,
|
||||
Snack = 4,
|
||||
}
|
||||
|
||||
public enum DietReminderType
|
||||
{
|
||||
Water = 0,
|
||||
Meal = 1,
|
||||
Snack = 2,
|
||||
Custom = 3,
|
||||
}
|
||||
|
||||
/// <summary>Bitmask for reminder days: Sun=1, Mon=2, Tue=4, Wed=8, Thu=16, Fri=32, Sat=64.</summary>
|
||||
public static class ReminderDaysMask
|
||||
{
|
||||
public const int All = 127;
|
||||
|
||||
public static bool IncludesDay(int mask, DayOfWeek day)
|
||||
{
|
||||
var bit = day switch
|
||||
{
|
||||
DayOfWeek.Sunday => 1,
|
||||
DayOfWeek.Monday => 2,
|
||||
DayOfWeek.Tuesday => 4,
|
||||
DayOfWeek.Wednesday => 8,
|
||||
DayOfWeek.Thursday => 16,
|
||||
DayOfWeek.Friday => 32,
|
||||
DayOfWeek.Saturday => 64,
|
||||
_ => 0,
|
||||
};
|
||||
return (mask & bit) != 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user