Initial model + some various changes
[recipes.git] / backend / src / model.rs
1 struct Recipe {
2 title: String,
3 estimate_time: Option<i32>, // [min].
4 difficulty: Option<Difficulty>,
5
6 //ingredients: Vec<Ingredient>, // For four people.
7 process: Vec<Group>,
8 }
9
10 struct Ingredient {
11 quantity: Option<Quantity>,
12 name: String,
13 }
14
15 struct Quantity {
16 value: f32,
17 unit: String,
18 }
19
20 struct Group {
21 name: Option<String>,
22 steps: Vec<Step>,
23 }
24
25 struct Step {
26 action: String,
27 input: Vec<StepInput>,
28 output: Vec<IntermediateSubstance>,
29 }
30
31 struct IntermediateSubstance {
32 name: String,
33 quantity: Option<Quantity>,
34 }
35
36 enum StepInput {
37 Ingredient(Ingredient),
38 IntermediateSubstance(IntermediateSubstance),
39 }
40
41 enum Difficulty {
42 Unknown,
43 Easy,
44 Medium,
45 Hard,
46 }