use anyhow::{Context, Error, anyhow};
use crate::{
BusinessProcessModelAndNotation,
stochastic_business_process_model_and_notation::StochasticBusinessProcessModelAndNotation,
};
impl From<StochasticBusinessProcessModelAndNotation> for BusinessProcessModelAndNotation {
fn from(value: StochasticBusinessProcessModelAndNotation) -> Self {
value.bpmn
}
}
impl TryFrom<BusinessProcessModelAndNotation> for StochasticBusinessProcessModelAndNotation {
type Error = Error;
fn try_from(value: BusinessProcessModelAndNotation) -> Result<Self, Self::Error> {
let result = Self { bpmn: value };
result.is_structurally_correct().with_context(|| anyhow!("Verifying structural correctness."))?;
Ok(result)
}
}