use ifc_model::{Entity, EntityId};
#[derive(Debug, Clone, Copy)]
pub struct CostSchedule<'m> {
id: EntityId,
entity: &'m Entity,
}
mod slot {
pub const GLOBAL_ID: usize = 0;
pub const NAME: usize = 2;
pub const IDENTIFICATION: usize = 5;
pub const PREDEFINED_TYPE: usize = 6;
pub const STATUS: usize = 7;
pub const SUBMITTED_ON: usize = 8;
pub const UPDATE_DATE: usize = 9;
}
impl<'m> CostSchedule<'m> {
pub fn new(id: EntityId, entity: &'m Entity) -> Self {
Self { id, entity }
}
pub fn id(&self) -> EntityId {
self.id
}
pub fn global_id(&self) -> Option<&'m str> {
self.entity.text(slot::GLOBAL_ID)
}
pub fn name(&self) -> Option<&'m str> {
self.entity.text(slot::NAME)
}
pub fn identification(&self) -> Option<&'m str> {
self.entity.text(slot::IDENTIFICATION)
}
pub fn status(&self) -> Option<&'m str> {
self.entity.text(slot::STATUS)
}
pub fn submitted_on(&self) -> Option<&'m str> {
self.entity.text(slot::SUBMITTED_ON)
}
pub fn update_date(&self) -> Option<&'m str> {
self.entity.text(slot::UPDATE_DATE)
}
pub fn predefined_type(&self) -> Option<&'m str> {
match self.entity.attribute(slot::PREDEFINED_TYPE)? {
ifc_model::Value::Enum(e) => Some(e),
_ => None,
}
}
}