dis_rs/common/is_group_of/
builder.rs1use crate::enumerations::IsGroupOfGroupedEntityCategory;
2use crate::is_group_of::model::{GroupEntityDescription, GroupReferencePoint, IsGroupOf};
3use crate::model::EntityId;
4
5pub struct IsGroupOfBuilder(IsGroupOf);
6
7impl Default for IsGroupOfBuilder {
8 fn default() -> Self {
9 Self::new()
10 }
11}
12
13impl IsGroupOfBuilder {
14 #[must_use]
15 pub fn new() -> Self {
16 IsGroupOfBuilder(IsGroupOf::default())
17 }
18
19 #[must_use]
20 pub fn new_from_body(body: IsGroupOf) -> Self {
21 IsGroupOfBuilder(body)
22 }
23
24 #[must_use]
25 pub fn build(self) -> IsGroupOf {
26 self.0
27 }
28
29 #[must_use]
30 pub fn with_group_id(mut self, group_id: EntityId) -> Self {
31 self.0.group_id = group_id;
32 self
33 }
34
35 #[must_use]
36 pub fn with_grouped_entity_category(
37 mut self,
38 grouped_entity_category: IsGroupOfGroupedEntityCategory,
39 ) -> Self {
40 self.0.grouped_entity_category = grouped_entity_category;
41 self
42 }
43
44 #[must_use]
45 pub fn with_group_reference_point(
46 mut self,
47 group_reference_point: GroupReferencePoint,
48 ) -> Self {
49 self.0.group_reference_point = group_reference_point;
50 self
51 }
52
53 #[must_use]
54 pub fn with_description(mut self, description: GroupEntityDescription) -> Self {
55 self.0.descriptions.push(description);
56 self
57 }
58
59 #[must_use]
60 pub fn with_descriptions(mut self, descriptions: Vec<GroupEntityDescription>) -> Self {
61 self.0.descriptions = descriptions;
62 self
63 }
64}