
export interface RecipeDuration {
  Total: number;
  Prep: number;
  Cook: number;
}

export const RECIPE_MEALS = [
  "breakfast",
  "lunch",
  "dinner",
  "dessert",
  "snack",
  "side",
  "other"
] as const;

export type RecipeMeal = (typeof RECIPE_MEALS)[number];

export function isRecipeMeal(value: string): value is RecipeMeal {
  return RECIPE_MEALS.includes(value as RecipeMeal);
}

export const INGREDIENT_UNITS = [
  "",
  "tsp",
  "tbsp",
  "fl oz",
  "cup",
  "ml",
  "l",
  "pt",
  "qt",
  "gal",
  "g",
  "kg",
  "oz",
  "lb",
  "piece",
  "clove",
  "slice",
  "stick",
  "bunch",
  "pinch",
  "dash",
  "splash",
  "to taste",
] as const;

export type RecipeIngredientUnit = (typeof INGREDIENT_UNITS)[number];

export function isRecipeUnit(value: string): value is RecipeIngredientUnit {
  return INGREDIENT_UNITS.includes(value as RecipeIngredientUnit);
}

export interface RecipeIngredient {
  Id: string;
  SectionId: string;
  Name: string;
  Amount: number;
  Unit: RecipeIngredientUnit;
}

export interface RecipeIngredientSection {
  Id: string;
  Name: string;
};

export interface RecipeInstruction {
  Id: string;
  Content: string;
}

export interface Tag {
  Id: number;
  Name: string;
  Created: Date;
}

export interface Recipe {
  Id: number;
  Title: string;
  Description: string;
  Instructions: RecipeInstruction[];
  Serves: number;
  Difficulty: number;
  Duration: RecipeDuration;
  Category: RecipeMeal;
  Ingredients: RecipeIngredient[];
  Sections: RecipeIngredientSection[];
  UserId: number;
  Modified: Date;
  Created: Date;
  Tags: Tag[];
  Favorite: boolean;
  Deleted: boolean;
}
