Initial model + some various changes
[recipes.git] / backend / src / model.rs
index ced209d..d012bc9 100644 (file)
@@ -1,10 +1,14 @@
 struct Recipe {\r
-   ingredients: Vec<Ingredient>,\r
-   process: Vec<Group>,\r
+    title: String,\r
+    estimate_time: Option<i32>, // [min].\r
+    difficulty: Option<Difficulty>,\r
+\r
+    //ingredients: Vec<Ingredient>, // For four people.\r
+    process: Vec<Group>,\r
 }\r
 \r
 struct Ingredient {\r
-    quantity: Quantity,\r
+    quantity: Option<Quantity>,\r
     name: String,\r
 }\r
 \r
@@ -12,15 +16,16 @@ struct Quantity {
     value: f32,\r
     unit: String,\r
 }\r
+\r
 struct Group {\r
-    name: String,\r
+    name: Option<String>,\r
     steps: Vec<Step>,\r
 }\r
 \r
 struct Step {\r
-   action: String,\r
-   input: Vec<StepInput>,\r
-   output: Vec<IntermediateSubstance>,\r
+    action: String,\r
+    input: Vec<StepInput>,\r
+    output: Vec<IntermediateSubstance>,\r
 }\r
 \r
 struct IntermediateSubstance {\r
@@ -30,5 +35,12 @@ struct IntermediateSubstance {
 \r
 enum StepInput {\r
     Ingredient(Ingredient),\r
-    IntermediateSubstance,\r
-}
\ No newline at end of file
+    IntermediateSubstance(IntermediateSubstance),\r
+}\r
+\r
+enum Difficulty {\r
+    Unknown,\r
+    Easy,\r
+    Medium,\r
+    Hard,\r
+}\r