use ifc_model::EntityId;
use thiserror::Error;
#[derive(Debug, Clone, PartialEq, Eq, Error)]
#[non_exhaustive]
pub enum CostAuthoringError {
#[error("invalid {entity}.{attribute}: {reason}")]
InvalidValue {
entity: &'static str,
attribute: &'static str,
reason: String,
},
#[error("{entity}.{attribute} references missing {target}")]
MissingReference {
entity: &'static str,
attribute: &'static str,
target: EntityId,
},
#[error("{entity}.{attribute} references {target} of type {actual}; expected {expected}")]
WrongReferenceType {
entity: &'static str,
attribute: &'static str,
target: EntityId,
actual: String,
expected: &'static str,
},
#[error("cost item {child} already has parent {existing_parent}")]
MultipleParents {
child: EntityId,
existing_parent: EntityId,
},
#[error("cost item nesting would create a cycle through {item}")]
NestingCycle {
item: EntityId,
},
}
pub type CostAuthoringResult<T> = Result<T, CostAuthoringError>;