#include "wire_Dialogue.hpp"
#include "../obapi_runtime.hpp"
#include <type_traits>
static_assert(static_cast<uint32_t>(::M_Dialogue::DialogueCategoryKind::Off) == 0u, "enum value M_Dialogue::DialogueCategoryKind::Type::Off differs from the data model");
static_assert(static_cast<uint32_t>(::M_Dialogue::DialogueCategoryKind::Trace) == 1u, "enum value M_Dialogue::DialogueCategoryKind::Type::Trace differs from the data model");
static_assert(static_cast<uint32_t>(::M_Dialogue::DialogueCategoryKind::Info) == 2u, "enum value M_Dialogue::DialogueCategoryKind::Type::Info differs from the data model");
static_assert(static_cast<uint32_t>(::M_Dialogue::DialogueCategoryKind::Warning) == 3u, "enum value M_Dialogue::DialogueCategoryKind::Type::Warning differs from the data model");
static_assert(static_cast<uint32_t>(::M_Dialogue::DialogueCategoryKind::Error) == 4u, "enum value M_Dialogue::DialogueCategoryKind::Type::Error differs from the data model");
static_assert(static_cast<uint32_t>(::M_Dialogue::DialogueCategoryKind::Question) == 5u, "enum value M_Dialogue::DialogueCategoryKind::Type::Question differs from the data model");
static_assert(std::is_same<::M_Dialogue::DialogueCategoryOptionalType, std::vector<::M_Dialogue::DialogueCategoryKind::Type>>::value, "typedef M_Dialogue::DialogueCategoryOptionalType differs from the data model");
static_assert(std::is_same<decltype(::M_Dialogue::InputChoiceType::Text), std::string>::value, "M_Dialogue::InputChoiceType field Text differs from the data model");
static_assert(std::is_same<decltype(::M_Dialogue::InputChoiceType::InputSelectionList), std::vector<std::string>>::value, "M_Dialogue::InputChoiceType field InputSelectionList differs from the data model");
static_assert(std::is_same<decltype(::M_Dialogue::InputChoiceType::Category), ::M_Dialogue::DialogueCategoryKind::Type>::value, "M_Dialogue::InputChoiceType field Category differs from the data model");
static_assert(std::is_same<decltype(::M_Dialogue::InputChoiceType::InitiatedByClientId), std::string>::value, "M_Dialogue::InputChoiceType field InitiatedByClientId differs from the data model");
namespace M_Dialogue {
void obapi_put(::obapi::Writer& w, InputChoiceType const& v) {
::obapi::put(w, v.Text);
::obapi::put(w, v.InputSelectionList);
::obapi::put(w, v.Category);
::obapi::put(w, v.InitiatedByClientId);
}
void obapi_get(::obapi::Reader& r, InputChoiceType& v) {
::obapi::get(r, v.Text);
::obapi::get(r, v.InputSelectionList);
::obapi::get(r, v.Category);
::obapi::get(r, v.InitiatedByClientId);
}
}
namespace {
struct ServiceCallbacks final : ::M_Dialogue::IService {
::obapi::Dispatcher dispatcher;
void ConfigLogLevel(::M_Dialogue::DialogueCategoryKind::Type Level) override {
::obapi::Writer w;
::obapi::put(w, Level);
dispatcher.dispatch(0u, w);
}
void CmdSelectInputChoice(::M_Common::ObjectIdType const& DialogueId, ::M_Common::StringListType const& SelectedInput) override {
::obapi::Writer w;
::obapi::put(w, DialogueId);
::obapi::put(w, SelectedInput);
dispatcher.dispatch(1u, w);
}
void NotifyTextMessage(std::string const& Text, ::M_Dialogue::DialogueCategoryOptionalType const& MessageType) override {
::obapi::Writer w;
::obapi::put(w, Text);
::obapi::put(w, MessageType);
dispatcher.dispatch(2u, w);
}
};
struct ClientCallbacks final : ::M_Dialogue::IClient {
::obapi::Dispatcher dispatcher;
void EventTextMessage(std::string const& Text, ::M_Dialogue::DialogueCategoryOptionalType const& MessageType) override {
::obapi::Writer w;
::obapi::put(w, Text);
::obapi::put(w, MessageType);
dispatcher.dispatch(0u, w);
}
void ReportInputChoice(::M_Common::ObjectIdType const& KeyDialogueId, ::M_Dialogue::InputChoiceType const& InputChoice, bool IsRemoved) override {
::obapi::Writer w;
::obapi::put(w, KeyDialogueId);
::obapi::put(w, InputChoice);
::obapi::put(w, IsRemoved);
dispatcher.dispatch(1u, w);
}
};
void service_send(::obapi::Holder<::M_Dialogue::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
switch (op) {
case 0u: {
std::string Text{};
::obapi::get(r, Text);
::M_Dialogue::DialogueCategoryOptionalType MessageType{};
::obapi::get(r, MessageType);
r.finish();
h.endpoint->EventTextMessage(Text, MessageType);
return;
}
case 1u: {
::M_Common::ObjectIdType KeyDialogueId{};
::obapi::get(r, KeyDialogueId);
::M_Dialogue::InputChoiceType InputChoice{};
::obapi::get(r, InputChoice);
bool IsRemoved{};
::obapi::get(r, IsRemoved);
r.finish();
h.endpoint->ReportInputChoice(KeyDialogueId, InputChoice, IsRemoved);
return;
}
default: throw ::obapi::UnknownOp(op);
}
}
void client_send(::obapi::Holder<::M_Dialogue::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
switch (op) {
case 0u: {
::M_Dialogue::DialogueCategoryKind::Type Level{};
::obapi::get(r, Level);
r.finish();
h.endpoint->ConfigLogLevel(Level);
return;
}
case 1u: {
::M_Common::ObjectIdType DialogueId{};
::obapi::get(r, DialogueId);
::M_Common::StringListType SelectedInput{};
::obapi::get(r, SelectedInput);
r.finish();
h.endpoint->CmdSelectInputChoice(DialogueId, SelectedInput);
return;
}
case 2u: {
std::string Text{};
::obapi::get(r, Text);
::M_Dialogue::DialogueCategoryOptionalType MessageType{};
::obapi::get(r, MessageType);
r.finish();
h.endpoint->NotifyTextMessage(Text, MessageType);
return;
}
default: throw ::obapi::UnknownOp(op);
}
}
}
extern "C" const obapi_vtable obapi_Dialogue_service_vtable = ::obapi::Endpoint<::M_Dialogue::Service, ServiceCallbacks, &service_send, false>::vtable("M_Dialogue", "Service");
extern "C" const obapi_vtable obapi_Dialogue_client_vtable = ::obapi::Endpoint<::M_Dialogue::Client, ClientCallbacks, &client_send, true>::vtable("M_Dialogue", "Client");