122 lines
6.8 KiB
C++
122 lines
6.8 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);
|
|
|
|
Json engine_environment_projection(const Json &bundle);
|
|
Json engine_environment_command(const Json &bundle, const std::string &item, int level, const std::string &request_id);
|
|
Json engine_advertising_projection(const Json &bundle);
|
|
Json engine_advertising_quote(const Json &bundle, int slot, int choice);
|
|
Json engine_advertising_command(const Json &bundle, const std::string &offer, const std::string &request_id);
|
|
Json engine_budget_command(const Json &bundle, const std::string &budget, int64_t euros, const std::string &request_id);
|
|
|
|
Json engine_contracts_projection(const Json &bundle);
|
|
Json engine_contract_request(const Json &bundle, const std::string &player, const std::string &request_id);
|
|
Json engine_contract_offer(const Json &bundle, const std::string &player, const std::string "e, int years, int64_t euros, const std::string &request_id);
|
|
Json engine_contract_cancel(const Json &bundle, const std::string "e, const std::string &request_id);
|
|
|
|
Json engine_calendar_projection(const Json &bundle);
|
|
Json engine_scheduling_projection(const Json &bundle);
|
|
Json engine_reschedule_command(const Json &bundle, const std::string &match, const std::string &date, const std::string &request_id);
|
|
Json engine_reschedule_undo(const Json &bundle, const std::string &date, const std::string &request_id);
|
|
|
|
Json engine_friendly_plan(const Json &bundle);
|
|
Json engine_friendly_projection(const Json &bundle, const Json &read, const std::string &opponent, bool home);
|
|
Json engine_friendly_command(const Json &bundle, const Json &read, const std::string &opponent, bool home, const std::string &date, bool accept_cost, bool opponent_consent, const std::string &request_id);
|
|
|
|
// Archive requests and immutable replies; no live-roster or current-name fallback.
|
|
std::string engine_almanac_key(const Json &query);
|
|
Json engine_almanac_projection(const Json &bundle, const Json &read, const Json &query);
|
|
|
|
Json engine_report_index(const Json &bundle,const Json &read);
|
|
Json engine_report_projection(const Json &bundle,const Json &index,const Json &read,const std::string &league,int filter);
|
|
Json engine_report_squad(const Json &bundle,const Json &read,const std::string &team);
|
|
Json engine_fixtures_projection(const Json &bundle,const Json &index,const Json &read,const std::string &league,int round);
|
|
|
|
Json engine_other_index(const Json &bundle,const Json &read);
|
|
Json engine_other_projection(const Json &bundle,const Json &index,const Json &read,const std::string &view,int round);
|
|
|
|
Json engine_rankings_projection(const Json &bundle,const Json &index,const Json &read,const std::string &league,int scope);
|
|
Json engine_fairplay_projection(const Json &bundle,const Json &index,const Json &read);
|
|
|
|
Json engine_stadium_projection(const Json &bundle,bool future);
|
|
Json engine_stadium_quote(const Json &bundle,const Json &draft);
|
|
Json engine_stadium_request(const Json &bundle,const Json &draft,const std::string &request_id,bool update=false);
|
|
Json engine_stadium_commit(const Json &bundle,bool accept,const std::string &request_id);
|
|
|
|
Json engine_toto_projection(const Json &bundle);
|
|
Json engine_toto_command(const Json &bundle,const Json "e,const std::string &request_id);
|
|
|
|
Json engine_statistics_projection(const Json &bundle,const Json &read);
|
|
|
|
Json engine_widgets_projection(const Json &bundle);
|
|
Json engine_indoor_projection(const Json &bundle);
|
|
Json engine_manager_projection(const Json &);
|
|
Json engine_manager_command(const Json &, const Json &, const std::string &, bool resign = false);
|
|
Json engine_settings_projection(const Json &bundle);
|
|
Json engine_settings_command(const Json &bundle, const Json &draft, const std::string &request_id);
|
|
Json engine_balance_projection(const Json &,const Json &);
|
|
Json engine_balance_command(const Json &,const Json &,const std::string &);
|
|
|
|
class NewsCatalog;
|
|
NewsCatalog engine_news_catalogue(const NewsCatalog &);
|
|
Json engine_news_projection(const Json &,const Json &,const NewsCatalog &,const std::string &);
|
|
Json engine_news_view(const Json &,const std::string &,const std::string &);
|
|
Json engine_news_command(const Json &,const Json &,const std::string &,const std::string &,const std::string &);
|
|
|
|
Json engine_achievements_projection(const Json &,const Json &,int page);
|
|
|
|
Json engine_transfer_filters();
|
|
Json engine_transfer_projection(const Json &,const Json &);
|
|
Json engine_transfer_command(const Json &,const Json &,const std::string &);
|
|
|
|
Json engine_opening_projection(const Json &bundle,const Json &read);
|
|
|
|
// 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);
|
|
static std::shared_ptr<EngineBridge> create(const fs::path &world,const Json &setup,const Json &managers,uint32_t seed);
|
|
~EngineBridge();
|
|
Json snapshot() const;
|
|
Json read(const Json &request) const;
|
|
Json command(const Json &request);
|
|
Json save_copy(const fs::path &path);
|
|
Json file_metadata() const;
|
|
Json load_same_world(const fs::path &path,const std::string &expected_token={});
|
|
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
|