swt23w23/src/main/java/catering/order/CustomOrder.java

72 lines
1.6 KiB
Java
Raw Normal View History

package catering.order;
import org.aspectj.weaver.ast.Or;
import org.salespointframework.quantity.Quantity;
2023-11-05 11:36:39 +01:00
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Map;
/**
* This class is only used for the prototype to avoid using the bloated Salespoint API
*/
public class CustomOrder {
private OrderType orderType;
2023-11-05 11:36:39 +01:00
private LocalDateTime start;
private LocalDateTime finish;
private Map<String, Quantity> products;
private boolean invoiceAvailable;
private double totalCost; // this is in €
private DateTimeFormatter formatter;
2023-11-05 11:36:39 +01:00
public CustomOrder(OrderType orderType, LocalDateTime start, LocalDateTime finish, Map<String, Quantity> products, boolean invoiceAvailable, double totalCost) {
this.orderType = orderType;
2023-11-05 11:36:39 +01:00
this.start = start;
this.finish = finish;
this.products = products;
this.invoiceAvailable = invoiceAvailable;
this.totalCost = totalCost;
this.formatter = DateTimeFormatter.ofPattern("MM.dd.yyy, HH:mm 'Uhr'");
}
public OrderType getOrderType() {
return orderType;
}
2023-11-05 11:36:39 +01:00
public LocalDateTime getStart() {
return start;
}
public String getFormattedStart() {
return start.format(formatter);
}
2023-11-05 11:36:39 +01:00
public LocalDateTime getFinish() {
return finish;
}
public String getFormattedFinish() {
return finish.format(formatter);
}
public Map<String, Quantity> getProducts() {
return products;
}
public boolean invoiceAvailable() {
return invoiceAvailable;
}
public double getTotalCost() {
return totalCost;
}
enum OrderType {
RENT_A_COOK,
EVENT_CATERING,
SUSHI_NIGHT,
SOMETHING_ELSE
}
}