ifc_cost/mutation/
draft.rs1use ifc_model::EntityId;
4
5use crate::ArithmeticOperator;
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
9pub enum CostItemType {
10 UserDefined,
12 NotDefined,
14}
15impl CostItemType {
16 pub(crate) const fn token(self) -> &'static str {
17 match self {
18 Self::UserDefined => "USERDEFINED",
19 Self::NotDefined => "NOTDEFINED",
20 }
21 }
22}
23
24#[derive(Debug, Clone, Copy, PartialEq, Eq)]
26pub enum CostScheduleType {
27 Budget,
29 CostPlan,
31 Estimate,
33 Tender,
35 PricedBillOfQuantities,
37 UnpricedBillOfQuantities,
39 ScheduleOfRates,
41 UserDefined,
43 NotDefined,
45}
46impl CostScheduleType {
47 pub(crate) const fn token(self) -> &'static str {
48 match self {
49 Self::Budget => "BUDGET",
50 Self::CostPlan => "COSTPLAN",
51 Self::Estimate => "ESTIMATE",
52 Self::Tender => "TENDER",
53 Self::PricedBillOfQuantities => "PRICEDBILLOFQUANTITIES",
54 Self::UnpricedBillOfQuantities => "UNPRICEDBILLOFQUANTITIES",
55 Self::ScheduleOfRates => "SCHEDULEOFRATES",
56 Self::UserDefined => "USERDEFINED",
57 Self::NotDefined => "NOTDEFINED",
58 }
59 }
60}
61
62#[derive(Debug, Clone, Copy)]
64pub enum CostValueKind<'a> {
65 Monetary(f64),
67 Components {
69 operator: ArithmeticOperator,
71 components: &'a [EntityId],
73 },
74}
75
76#[derive(Debug, Clone, Copy)]
77pub struct CostValueDraft<'a> {
79 pub name: Option<&'a str>,
81 pub description: Option<&'a str>,
83 pub applicable_date: Option<&'a str>,
85 pub fixed_until_date: Option<&'a str>,
87 pub category: Option<&'a str>,
89 pub condition: Option<&'a str>,
91 pub kind: CostValueKind<'a>,
93}
94impl CostValueDraft<'_> {
95 #[must_use]
96 pub fn monetary(amount: f64) -> Self {
98 Self {
99 kind: CostValueKind::Monetary(amount),
100 ..Self::default()
101 }
102 }
103}
104impl Default for CostValueDraft<'_> {
105 fn default() -> Self {
106 Self {
107 name: None,
108 description: None,
109 applicable_date: None,
110 fixed_until_date: None,
111 category: None,
112 condition: None,
113 kind: CostValueKind::Monetary(0.0),
114 }
115 }
116}
117
118#[derive(Debug, Clone, Copy, Default)]
119pub struct CostItemDraft<'a> {
121 pub global_id: &'a str,
123 pub name: Option<&'a str>,
125 pub description: Option<&'a str>,
127 pub object_type: Option<&'a str>,
129 pub identification: Option<&'a str>,
131 pub predefined_type: Option<CostItemType>,
133 pub cost_values: &'a [EntityId],
135}
136#[derive(Debug, Clone, Copy, Default)]
137pub struct CostScheduleDraft<'a> {
139 pub global_id: &'a str,
141 pub name: Option<&'a str>,
143 pub description: Option<&'a str>,
145 pub object_type: Option<&'a str>,
147 pub identification: Option<&'a str>,
149 pub predefined_type: Option<CostScheduleType>,
151 pub status: Option<&'a str>,
153 pub submitted_on: Option<&'a str>,
155 pub update_date: Option<&'a str>,
157}
158#[derive(Debug, Clone, Copy)]
159pub struct NestingDraft<'a> {
161 pub global_id: &'a str,
163 pub parent: EntityId,
165 pub children: &'a [EntityId],
167}
168#[derive(Debug, Clone, Copy)]
169pub struct ScheduleAssignmentDraft<'a> {
171 pub global_id: &'a str,
173 pub schedule: EntityId,
175 pub items: &'a [EntityId],
177}