#pragma once #include #include #include #include #include #include namespace renderive::web { enum class Gallery_Frame_Mode : std::uint8_t { Manual, Low_Latency, Playback }; struct Gallery_Open_Request { std::string case_id; Gallery_Frame_Mode frame_mode = Gallery_Frame_Mode::Low_Latency; }; using Gallery_Value = std::variant; struct Gallery_State { std::map> values; }; struct Gallery_Patch_Result { std::optional candidate; std::string response_json; }; struct Gallery_Action_Request { std::string id; std::optional argument; }; class Gallery_Protocol final { public: [[nodiscard]] static std::string catalog_json(); [[nodiscard]] static bool is_case(std::string_view case_id); [[nodiscard]] static Gallery_State default_state(std::string_view case_id); [[nodiscard]] static Gallery_State default_state( std::string_view case_id, Gallery_Frame_Mode frame_mode); [[nodiscard]] static std::string case_json( std::string_view case_id, const Gallery_State& state, std::string_view telemetry_json = "{}", std::string_view notice = {}); [[nodiscard]] static std::string case_json( std::string_view case_id, const Gallery_State& state, std::string_view telemetry_json, std::string_view notice, Gallery_Frame_Mode frame_mode); [[nodiscard]] static std::string error_json( std::string_view message, std::string_view field = {}); [[nodiscard]] static std::string observer_json( std::string_view case_id, Gallery_Frame_Mode frame_mode, std::string_view telemetry_json); [[nodiscard]] static Gallery_Patch_Result apply_patch( std::string_view case_id, const Gallery_State& current, std::string_view message); [[nodiscard]] static Gallery_Patch_Result apply_patch( std::string_view case_id, const Gallery_State& current, std::string_view message, Gallery_Frame_Mode frame_mode); [[nodiscard]] static std::optional open_request( std::string_view message); [[nodiscard]] static std::optional action_request( std::string_view message); [[nodiscard]] static std::size_t control_count(std::string_view case_id); [[nodiscard]] static std::size_t control_count( std::string_view case_id, Gallery_Frame_Mode frame_mode); [[nodiscard]] static std::size_t action_count(std::string_view case_id); [[nodiscard]] static std::size_t action_count( std::string_view case_id, Gallery_Frame_Mode frame_mode); [[nodiscard]] static bool action_available( std::string_view case_id, Gallery_Frame_Mode frame_mode, std::string_view action_id); }; } // namespace renderive::web