# The pipeline's process, as the customer sees and signs it (erp_platform.bpmn renders it at GET /process/bpmn).
# The shape of a module spec's `workflows:` (erp-method modules/crm, workflows.opportunity), written from what this
# brick's use cases do. Keys are the BPMN ids: frozen once signed — a renamed step gets a new key.
version: 1
name: Pipeline
actors:
- { id: rep, name: Sales rep }
- { id: manager, name: Sales manager }
- { id: system, name: The system }
workflows:
- entity: opportunity
states: the business's own stages (pipeline_stages), each open, won or lost
terminal: [won, lost]
transitions:
- { key: open_opportunity, from: none, to: open, by: rep, name: Open a deal }
- { key: open_opportunity_from_source, from: none, to: open, by: system, name: Open the deal of a converted lead,
effect: "the same source document always returns the same deal (CRM-03)" }
- { key: move_stage, from: open, to: open, by: [rep, manager], name: Move to another open stage }
- { key: win, from: open, to: won, by: rep, name: Mark won,
gate: "the customer accepted a quote on this deal, in its currency", effect: "the deal takes the accepted total" }
- { key: lose, from: open, to: lost, by: rep, name: Mark lost, requires: a reason from the agreed list }
- { key: reopen_opportunity, from: [won, lost], to: open, by: manager, name: Reopen a closed deal,
requires: a reason, effect: "reopening a won deal voids the quotes that won it" }