#pragma once #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_Action_Request { std::string id; std::optional argument; }; struct Gallery_Control_Patch_Request { std::string target; std::string patch_json; }; class Gallery_Protocol final { public: [[nodiscard]] static std::string catalog_json(); [[nodiscard]] static bool is_case(std::string_view case_id); [[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 std::string case_json_from_controls( std::string_view case_id, std::string_view controls_json, std::string_view telemetry_json, std::string_view notice, 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::optional control_patch_request( std::string_view message); [[nodiscard]] static bool action_available(std::string_view case_id, Gallery_Frame_Mode frame_mode, std::string_view action_id); }; } // namespace renderive::web