Add `WorkflowConstraint` for built-in workflows
This change adds an enum, `WorkflowConstraint` to the purchase order
smart contract's workflow module. These constraints are defined by the
purchase order built-in workflows.
@@ -25,6 +25,13 @@ pub enum POWorkflow {
Collaborative,
}
+pub enum WorkflowConstraint {
+ Accepted,
+ Closed,
+ Draft,
+ Complete,
+}
+
pub fn get_workflow(name: &str) -> Option<Workflow> {
match name {
"built-in::system_of_record::v1" => Some(system_of_record_workflow()),
@@ -423,3 +430,14 @@ impl fmt::Display for POWorkflow {
}
}
}
+
+impl fmt::Display for WorkflowConstraint {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match *self {
+ WorkflowConstraint::Accepted => write!(f, "accepted"),
+ WorkflowConstraint::Complete => write!(f, "complete"),
+ WorkflowConstraint::Closed => write!(f, "closed"),
+ WorkflowConstraint::Draft => write!(f, "draft"),
+ }
+ }
+}
