#ifndef COURT_MONITOR_DIALOG_HELPERS_H #define COURT_MONITOR_DIALOG_HELPERS_H #include "Logger.h" #include "Storage.h" #include #include #include namespace statechart = boost::statechart; template struct StateMachine : public statechart::state_machine { explicit StateMachine(banana::agent::beast_callback& agent, banana::integer_t userId) : agent(agent), userId(userId) { } banana::agent::beast_callback& agent; banana::integer_t userId; }; struct BasicState { [[nodiscard]] virtual bool isFinal() const noexcept = 0; }; template class State : public statechart::state, public BasicState { public: State(typename statechart::state::my_context ctx, const char* name) : statechart::state(ctx), name_(name) { LOG(dialog, "entering state {}", name_); } ~State() { LOG(dialog, "leaving state {}", name_); } [[nodiscard]] bool isFinal() const noexcept override { return IsFinal; } private: const char* name_; }; struct NewMessageEvent : statechart::event { explicit NewMessageEvent(banana::api::message_t message) : message(std::move(message)) {} banana::api::message_t message; }; struct NewCallbackQueryEvent : statechart::event { explicit NewCallbackQueryEvent(banana::api::callback_query_t query) : query(std::move(query)) {} banana::api::callback_query_t query; }; #endif // COURT_MONITOR_DIALOG_HELPERS_H