#pragma once #include #include #include namespace svapi { /// Returns `project + ":" + collection` for named projects; returns bare /// `collection` when project is "" or "default" (back-compat default project). std::string qualify(const std::string& project, const std::string& collection); /// Thin wrapper over `smartbotic::database::Client` that adds project-level /// helpers (listProjects / ensureProject / dropProject) and a uniform /// connect/healthy lifecycle. class DbGateway { public: /// @param address host:port of the smartbotic-database gRPC endpoint. /// @param timeoutMs per-call timeout in milliseconds (default 5 s). explicit DbGateway(std::string address, uint32_t timeoutMs = 5000); /// Establish the gRPC connection. Returns true on success. bool connect(); /// Returns true if the server responds to a health-check ping. bool healthy(); /// Direct access to the underlying client for collection/document ops. smartbotic::database::Client& client(); /// List all projects on the server (always includes "default"). std::vector listProjects(); /// Idempotent createProject. Returns true on success (new or already existed). bool ensureProject(const std::string& name); /// Drop a project. Returns false (without throwing) when name == "default". /// Returns false on any transport or server-side failure. bool dropProject(const std::string& name); private: smartbotic::database::Client client_; }; } // namespace svapi