50 lines
2.2 KiB
C++
50 lines
2.2 KiB
C++
// SPDX-License-Identifier: GPL-3.0-only
|
|
#pragma once
|
|
#include "modern/ui/catalog.hpp"
|
|
#include <memory>
|
|
|
|
namespace bmh::modern_ui {
|
|
// Engine DTOs remain separate from DemoSource's presentation checkpoints.
|
|
void validate_engine_desk(const Json &bundle);
|
|
int64_t engine_money_minor(const Json &money);
|
|
Json engine_camp_command(const Json &bundle, const std::string &camp,
|
|
const Json &focus, const std::string &request_id);
|
|
// Pure presentation of the authoritative squad/board; absent statistics stay null.
|
|
Json engine_lineup_projection(const Json &bundle);
|
|
Json engine_lineup_command(const Json &bundle, const Json &order,
|
|
const std::string &request_id);
|
|
Json engine_tactics_projection(const Json &bundle);
|
|
Json engine_training_projection(const Json &bundle);
|
|
Json engine_tactics_command(const Json &bundle, const Json &values,
|
|
const std::string &request_id);
|
|
Json engine_training_command(const Json &bundle, const Json &draft,
|
|
const std::string &request_id);
|
|
Json engine_bank_projection(const Json &bundle);
|
|
Json engine_bank_command(const Json &bundle, const Json &payload, const std::string &request_id);
|
|
Json engine_credit_projection(const Json &bundle, const Json &read);
|
|
Json engine_credit_command(const Json &bundle, const Json &read, const Json &edits, const std::string &request_id);
|
|
Json engine_ticket_projection(const Json &bundle);
|
|
Json engine_ticket_command(const Json &bundle, int euros, const std::string &request_id);
|
|
|
|
// Single-session facade. Its owner serializes all calls on a background worker.
|
|
// No RmlUI objects or callbacks cross this boundary.
|
|
class EngineBridge {
|
|
public:
|
|
static std::shared_ptr<EngineBridge> open(const fs::path &world, const fs::path &save);
|
|
~EngineBridge();
|
|
Json snapshot() const;
|
|
Json read(const Json &request) const;
|
|
Json command(const Json &request);
|
|
Json save_copy(const fs::path &path);
|
|
private:
|
|
struct Impl;
|
|
explicit EngineBridge(std::unique_ptr<Impl>);
|
|
std::unique_ptr<Impl> impl_;
|
|
};
|
|
struct EngineReply {
|
|
std::shared_ptr<EngineBridge> connection;
|
|
Json bundle, response;
|
|
std::shared_ptr<const Catalog> catalog;
|
|
};
|
|
} // namespace bmh::modern_ui
|