#ifndef ORDERSERVICE_H #define ORDERSERVICE_H #include "../models/order.h" #include class OrderService { public: static OrderService &instance(); QList listOrders(QString *error = nullptr, int limit = 100); bool findOrder(int id, Order *order, QString *error = nullptr); bool findUnfinishedOrder(Order *order, QString *error = nullptr); bool createOrder(Order *order, QString *error = nullptr); bool generateWorkpiecesAndAssign(int orderId, QString *error = nullptr); bool validateWorkpieceAllocation(int orderId, QString *error = nullptr); bool startOrder(int id, QString *error = nullptr); bool pauseOrder(int id, QString *error = nullptr); bool resumeOrder(int id, QString *error = nullptr); bool completeOrder(int id, QString *error = nullptr); bool terminateOrder(int id, QString *error = nullptr); bool cancelOrder(int id, QString *error = nullptr); bool deleteOrder(int id, QString *error = nullptr); private: OrderService() = default; OrderService(const OrderService &) = delete; OrderService &operator=(const OrderService &) = delete; bool transition(int id, const QStringList &allowedStates, const QString &targetState, const QString &action, QString *error); }; #endif // ORDERSERVICE_H