use ifc_model::EntityId;
use crate::ArithmeticOperator;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CostItemType {
UserDefined,
NotDefined,
}
impl CostItemType {
pub(crate) const fn token(self) -> &'static str {
match self {
Self::UserDefined => "USERDEFINED",
Self::NotDefined => "NOTDEFINED",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CostScheduleType {
Budget,
CostPlan,
Estimate,
Tender,
PricedBillOfQuantities,
UnpricedBillOfQuantities,
ScheduleOfRates,
UserDefined,
NotDefined,
}
impl CostScheduleType {
pub(crate) const fn token(self) -> &'static str {
match self {
Self::Budget => "BUDGET",
Self::CostPlan => "COSTPLAN",
Self::Estimate => "ESTIMATE",
Self::Tender => "TENDER",
Self::PricedBillOfQuantities => "PRICEDBILLOFQUANTITIES",
Self::UnpricedBillOfQuantities => "UNPRICEDBILLOFQUANTITIES",
Self::ScheduleOfRates => "SCHEDULEOFRATES",
Self::UserDefined => "USERDEFINED",
Self::NotDefined => "NOTDEFINED",
}
}
}
#[derive(Debug, Clone, Copy)]
pub enum CostValueKind<'a> {
Monetary(f64),
Components {
operator: ArithmeticOperator,
components: &'a [EntityId],
},
}
#[derive(Debug, Clone, Copy)]
pub struct CostValueDraft<'a> {
pub name: Option<&'a str>,
pub description: Option<&'a str>,
pub applicable_date: Option<&'a str>,
pub fixed_until_date: Option<&'a str>,
pub category: Option<&'a str>,
pub condition: Option<&'a str>,
pub kind: CostValueKind<'a>,
}
impl CostValueDraft<'_> {
#[must_use]
pub fn monetary(amount: f64) -> Self {
Self {
kind: CostValueKind::Monetary(amount),
..Self::default()
}
}
}
impl Default for CostValueDraft<'_> {
fn default() -> Self {
Self {
name: None,
description: None,
applicable_date: None,
fixed_until_date: None,
category: None,
condition: None,
kind: CostValueKind::Monetary(0.0),
}
}
}
#[derive(Debug, Clone, Copy, Default)]
pub struct CostItemDraft<'a> {
pub global_id: &'a str,
pub name: Option<&'a str>,
pub description: Option<&'a str>,
pub object_type: Option<&'a str>,
pub identification: Option<&'a str>,
pub predefined_type: Option<CostItemType>,
pub cost_values: &'a [EntityId],
}
#[derive(Debug, Clone, Copy, Default)]
pub struct CostScheduleDraft<'a> {
pub global_id: &'a str,
pub name: Option<&'a str>,
pub description: Option<&'a str>,
pub object_type: Option<&'a str>,
pub identification: Option<&'a str>,
pub predefined_type: Option<CostScheduleType>,
pub status: Option<&'a str>,
pub submitted_on: Option<&'a str>,
pub update_date: Option<&'a str>,
}
#[derive(Debug, Clone, Copy)]
pub struct NestingDraft<'a> {
pub global_id: &'a str,
pub parent: EntityId,
pub children: &'a [EntityId],
}
#[derive(Debug, Clone, Copy)]
pub struct ScheduleAssignmentDraft<'a> {
pub global_id: &'a str,
pub schedule: EntityId,
pub items: &'a [EntityId],
}