In an order management system for example, what's the best way to plot the states of different objects that overlap and interconnect at different states?
- Order object will have states like Draft, Confirmed, Placed, Picked, Delivered...etc.
- Invoice object will have states like Opened, Paid, Closed...etc.
Knowing that an invoice will be opened immediately when an order is "Confirmed", but the order cannot be "Placed" until the invoice is in state "Paid", the invoice from there will be closed by finance team upon checking and validating the amount, during that time, the order will proceed with its normal states without invoice being affected.
What's the proper way to plot this? One order might have multiple invoices, putting the invoice states as part of order lifecycle won't work, they have to be separate objects with separate states.