1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
* rocie-server
*
* An enterprise grocery management system - server
*
* The version of the OpenAPI document: 0.1.0
* Contact: benedikt.peetz@b-peetz.de
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// Product : The base of rocie. Products can be bought and consumed and represent, what you actually have in storage. Not every product is bought, as some can also be obtained by cooking a recipe.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Product {
/// Which barcodes are associated with this product.
#[serde(rename = "associated_bar_codes")]
pub associated_bar_codes: Vec<models::Barcode>,
/// An optional description of this product.
#[serde(rename = "description", skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// The id of the product.
#[serde(rename = "id")]
pub id: models::ProductId,
/// The name of the product. This should be globally unique, to make searching easier for the user.
#[serde(rename = "name")]
pub name: String,
/// The parent this product has. This is effectively it's anchor in the product DAG. None means, that it has no parents and as such is in the toplevel.
#[serde(rename = "parent", skip_serializing_if = "Option::is_none")]
pub parent: Option<models::ProductParentId>,
/// The property this product is measured in. (This is probably always either Mass, Volume or Quantity).
#[serde(rename = "unit_property")]
pub unit_property: models::UnitPropertyId,
}
impl Product {
/// The base of rocie. Products can be bought and consumed and represent, what you actually have in storage. Not every product is bought, as some can also be obtained by cooking a recipe.
pub fn new(associated_bar_codes: Vec<models::Barcode>, id: models::ProductId, name: String, unit_property: models::UnitPropertyId) -> Product {
Product {
associated_bar_codes,
description: None,
id,
name,
parent: None,
unit_property,
}
}
}
|