content: package factories;
  
  import java.util.List;
  import models.*;
  import strategies.*;
  
  public class ScheduledOrderFactory implements OrderFactory {
      private String scheduleTime;
  
      public ScheduledOrderFactory(String scheduleTime) {
          this.scheduleTime = scheduleTime;
      }
  
      @Override
      public Order createOrder(User user, Cart cart, Restaurant restaurant, List<MenuItem> menuItems,
                               PaymentStrategy paymentStrategy, double totalCost, String orderType) {
          Order order = null;
  
          if (orderType.equals("Delivery")) {
              DeliveryOrder deliveryOrder = new DeliveryOrder();
              deliveryOrder.setUserAddress(user.getAddress());
              order = deliveryOrder;
          } else {
              PickupOrder pickupOrder = new PickupOrder();
              pickupOrder.setRestaurantAddress(restaurant.getLocation());
              order = pickupOrder;
          }
  
          order.setUser(user);
          order.setRestaurant(restaurant);
          order.setItems(menuItems);
          order.setPaymentStrategy(paymentStrategy);
          order.setScheduled(scheduleTime);
          order.setTotal(totalCost);
          return order;
      }
  }
  