Skip to main content

rocie_client/models/
unit_property.rs

1// rocie - An enterprise grocery management system
2//
3// Copyright (C) 2026 Benedikt Peetz <benedikt.peetz@b-peetz.de>
4// SPDX-License-Identifier: GPL-3.0-or-later
5//
6// This file is part of Rocie.
7//
8// You should have received a copy of the License along with this program.
9// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
10
11/*
12 * rocie-server
13 *
14 * An enterprise grocery management system - server
15 *
16 * The version of the OpenAPI document: 0.1.0
17 * Contact: benedikt.peetz@b-peetz.de
18 * Generated by: https://openapi-generator.tech
19 */
20
21use crate::models;
22use serde::{Deserialize, Serialize};
23
24/// UnitProperty : An unit property describes a property that can be measured by units. For example velocity, mass or volume.
25#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
26pub struct UnitProperty {
27    /// An description of this property.
28    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
29    pub description: Option<String>,
30    /// The unique ID for this unit property.
31    #[serde(rename = "id")]
32    pub id: models::UnitPropertyId,
33    /// The user-displayed name of this property.
34    #[serde(rename = "name")]
35    pub name: String,
36    /// The units with are measuring this property.
37    #[serde(rename = "units")]
38    pub units: Vec<models::UnitId>,
39}
40
41impl UnitProperty {
42    /// An unit property describes a property that can be measured by units. For example velocity, mass or volume.
43    pub fn new(
44        id: models::UnitPropertyId,
45        name: String,
46        units: Vec<models::UnitId>,
47    ) -> UnitProperty {
48        UnitProperty {
49            description: None,
50            id,
51            name,
52            units,
53        }
54    }
55}