I'm creating an application that allows you to input Orders, an order has some basic information: who ordered it, what date, etc. It also has a list of line items that are ordered. Each line item can (probably 50% of the time) have it's own delivery date separate from each of the other line items, they can also be started and cancelled individually.
I'm struggling with how to model the status of each order and how the user should be able to change those statuses.
One thought I've had is for the whole Order to be just Opened/Closed and have that computed based on whether all the line item statuses are Closed or not. The other option is to be able to set status explicitly on the overall order but then order status and line item status could get out of sync (why is the order closed if the line item is open).
Anybody have insight as to what would be a good approach here? Are there any examples out there that deal with this in an elegant way?