// Utility to calculate order status based on current state
export function calculateOrderStatus(event) {
  // Check explicit statuses first
  if (event.status === "Canceled" || event.status === "Cancelled") {
    return "Canceled";
  }
  
  if (event.status === "Draft") {
    return "Draft";
  }
  
  if (event.status === "Completed") {
    return "Completed";
  }
  
  // Calculate status based on staffing
  const requested = event.requested || 0;
  const assigned = event.assigned_staff?.length || 0;
  
  if (requested === 0) {
    return "Draft"; // No staff requested yet
  }
  
  if (assigned === 0) {
    return "Pending"; // Awaiting assignment
  }
  
  if (assigned < requested) {
    return "Partial"; // Partially staffed
  }
  
  if (assigned >= requested) {
    return "Confirmed"; // Fully staffed
  }
  
  return "Pending";
}