ORE Studio 0.0.4
Loading...
Searching...
No Matches
TenantProvisioningWizard.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2026 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_QT_TENANT_PROVISIONING_WIZARD_HPP
21#define ORES_QT_TENANT_PROVISIONING_WIZARD_HPP
22
23#include <QWizard>
24#include <QWizardPage>
25#include <QCheckBox>
26#include <QComboBox>
27#include <QLabel>
28#include <QLineEdit>
29#include <QProgressBar>
30#include <QRadioButton>
31#include <QSpinBox>
32#include <QTextEdit>
33#include <QPushButton>
34#include <cstdint>
35#include <optional>
36#include <string>
37#include "ores.logging/make_logger.hpp"
38#include "ores.qt/ClientManager.hpp"
39
40namespace ores::qt {
41
42class ClientDatasetBundleModel;
43class LeiEntityPicker;
44
64class TenantProvisioningWizard final : public QWizard {
65 Q_OBJECT
66
67private:
68 inline static std::string_view logger_name =
69 "ores.qt.tenant_provisioning_wizard";
70
71 [[nodiscard]] static auto& lg() {
72 using namespace ores::logging;
73 static auto instance = make_logger(logger_name);
74 return instance;
75 }
76
77public:
78 enum PageId {
79 Page_Welcome,
80 Page_BundleSelection,
81 Page_BundleInstall,
82 Page_DataSourceSelection,
83 Page_PartySetup,
84 Page_PartyOrganisation,
85 Page_Summary
86 };
87
88 enum class DataSourceMode { gleif, synthetic };
89
91 ClientManager* clientManager,
92 QWidget* parent = nullptr);
93
94 ~TenantProvisioningWizard() override = default;
95
96 ClientManager* clientManager() const { return clientManager_; }
97
98 QString selectedBundleCode() const { return selectedBundleCode_; }
99 void setSelectedBundleCode(const QString& code) { selectedBundleCode_ = code; }
100
101 QString selectedBundleName() const { return selectedBundleName_; }
102 void setSelectedBundleName(const QString& name) { selectedBundleName_ = name; }
103
104 // --- GLEIF / synthetic party setup state ---
105 DataSourceMode dataSourceMode() const { return dataSourceMode_; }
106 void setDataSourceMode(DataSourceMode m) { dataSourceMode_ = m; }
107
108 QString rootLei() const { return rootLei_; }
109 void setRootLei(const QString& lei) { rootLei_ = lei; }
110
111 QString rootLeiName() const { return rootLeiName_; }
112 void setRootLeiName(const QString& name) { rootLeiName_ = name; }
113
114 QString leiDatasetSize() const { return leiDatasetSize_; }
115 void setLeiDatasetSize(const QString& size) { leiDatasetSize_ = size; }
116
117 QString syntheticCountry() const { return syntheticCountry_; }
118 void setSyntheticCountry(const QString& c) { syntheticCountry_ = c; }
119
120 int syntheticPartyCount() const { return syntheticPartyCount_; }
121 void setSyntheticPartyCount(int v) { syntheticPartyCount_ = v; }
122
123 int syntheticPartyMaxDepth() const { return syntheticPartyMaxDepth_; }
124 void setSyntheticPartyMaxDepth(int v) { syntheticPartyMaxDepth_ = v; }
125
126 int syntheticCounterpartyCount() const { return syntheticCounterpartyCount_; }
127 void setSyntheticCounterpartyCount(int v) { syntheticCounterpartyCount_ = v; }
128
129 int syntheticCounterpartyMaxDepth() const { return syntheticCounterpartyMaxDepth_; }
130 void setSyntheticCounterpartyMaxDepth(int v) { syntheticCounterpartyMaxDepth_ = v; }
131
132 int syntheticPortfolioLeafCount() const { return syntheticPortfolioLeafCount_; }
133 void setSyntheticPortfolioLeafCount(int v) { syntheticPortfolioLeafCount_ = v; }
134
135 int syntheticPortfolioMaxDepth() const { return syntheticPortfolioMaxDepth_; }
136 void setSyntheticPortfolioMaxDepth(int v) { syntheticPortfolioMaxDepth_ = v; }
137
138 int syntheticBooksPerPortfolio() const { return syntheticBooksPerPortfolio_; }
139 void setSyntheticBooksPerPortfolio(int v) { syntheticBooksPerPortfolio_ = v; }
140
141 int syntheticBusinessUnitCount() const { return syntheticBusinessUnitCount_; }
142 void setSyntheticBusinessUnitCount(int v) { syntheticBusinessUnitCount_ = v; }
143
144 int syntheticBusinessUnitMaxDepth() const { return syntheticBusinessUnitMaxDepth_; }
145 void setSyntheticBusinessUnitMaxDepth(int v) { syntheticBusinessUnitMaxDepth_ = v; }
146
147 bool syntheticGenerateAddresses() const { return syntheticGenerateAddresses_; }
148 void setSyntheticGenerateAddresses(bool v) { syntheticGenerateAddresses_ = v; }
149
150 int syntheticContactsPerParty() const { return syntheticContactsPerParty_; }
151 void setSyntheticContactsPerParty(int v) { syntheticContactsPerParty_ = v; }
152
153 int syntheticContactsPerCounterparty() const { return syntheticContactsPerCounterparty_; }
154 void setSyntheticContactsPerCounterparty(int v) { syntheticContactsPerCounterparty_ = v; }
155
156 bool syntheticGenerateIdentifiers() const { return syntheticGenerateIdentifiers_; }
157 void setSyntheticGenerateIdentifiers(bool v) { syntheticGenerateIdentifiers_ = v; }
158
159 std::optional<std::uint64_t> syntheticSeed() const { return syntheticSeed_; }
160 void setSyntheticSeed(std::optional<std::uint64_t> v) { syntheticSeed_ = v; }
161
162 int partiesLinkedCount() const { return partiesLinkedCount_; }
163 void setPartiesLinkedCount(int n) { partiesLinkedCount_ = n; }
164
168 void clearBootstrapFlag();
169
170signals:
171 void provisioningCompleted();
172
173private:
174 void setupPages();
175
176 ClientManager* clientManager_;
177 QString selectedBundleCode_;
178 QString selectedBundleName_;
179
180 // Party setup state
181 DataSourceMode dataSourceMode_ = DataSourceMode::gleif;
182 QString rootLei_;
183 QString rootLeiName_;
184 QString leiDatasetSize_;
185 QString syntheticCountry_;
186 int syntheticPartyCount_ = 5;
187 int syntheticPartyMaxDepth_ = 3;
188 int syntheticCounterpartyCount_ = 10;
189 int syntheticCounterpartyMaxDepth_ = 3;
190 int syntheticPortfolioLeafCount_ = 8;
191 int syntheticPortfolioMaxDepth_ = 4;
192 int syntheticBooksPerPortfolio_ = 2;
193 int syntheticBusinessUnitCount_ = 10;
194 int syntheticBusinessUnitMaxDepth_ = 2;
195 bool syntheticGenerateAddresses_ = true;
196 int syntheticContactsPerParty_ = 2;
197 int syntheticContactsPerCounterparty_ = 1;
198 bool syntheticGenerateIdentifiers_ = true;
199 std::optional<std::uint64_t> syntheticSeed_;
200 int partiesLinkedCount_ = 0;
201};
202
203// Forward declarations
211
215class ProvisioningWelcomePage final : public QWizardPage {
216 Q_OBJECT
217
218public:
220
221private:
222 void setupUI();
224};
225
229class BundleSelectionPage final : public QWizardPage {
230 Q_OBJECT
231
232public:
234 void initializePage() override;
235 bool validatePage() override;
236 bool isComplete() const override;
237
238private:
239 void setupUI();
240 void onBundleChanged(int index);
241
243 ClientDatasetBundleModel* bundleModel_;
244 QComboBox* bundleCombo_;
245 QLabel* descriptionLabel_;
246 QLabel* statusLabel_;
247};
248
252class BundleInstallPage final : public QWizardPage {
253 Q_OBJECT
254
255private:
256 inline static std::string_view logger_name =
257 "ores.qt.bundle_install_page";
258
259 [[nodiscard]] static auto& lg() {
260 using namespace ores::logging;
261 static auto instance = make_logger(logger_name);
262 return instance;
263 }
264
265public:
267 void initializePage() override;
268 bool isComplete() const override;
269
270private:
271 void startPublish();
272 void appendLog(const QString& message);
273
275 QLabel* statusLabel_;
276 QProgressBar* progressBar_;
277 QTextEdit* logOutput_;
278 bool publishComplete_ = false;
279 bool publishSuccess_ = false;
280};
281
285class TenantDataSourceSelectionPage final : public QWizardPage {
286 Q_OBJECT
287
288public:
290 bool validatePage() override;
291 int nextId() const override;
292
293private:
294 void setupUI();
295 void onModeChanged();
296
298 QRadioButton* gleifRadio_;
299 QRadioButton* syntheticRadio_;
300 QWidget* syntheticOptions_;
301 QComboBox* countryCombo_;
302 QSpinBox* partyCountSpin_;
303 QSpinBox* partyMaxDepthSpin_;
304 QSpinBox* counterpartyCountSpin_;
305 QSpinBox* counterpartyMaxDepthSpin_;
306 QSpinBox* portfolioLeafCountSpin_;
307 QSpinBox* portfolioMaxDepthSpin_;
308 QSpinBox* booksPerPortfolioSpin_;
309 QSpinBox* businessUnitCountSpin_;
310 QSpinBox* businessUnitMaxDepthSpin_;
311 QSpinBox* contactsPerPartySpin_;
312 QSpinBox* contactsPerCounterpartySpin_;
313 QCheckBox* generateAddressesCheck_;
314 QCheckBox* generateIdentifiersCheck_;
315 QLineEdit* seedEdit_;
316};
317
321class TenantPartySetupPage final : public QWizardPage {
322 Q_OBJECT
323
324public:
326 void initializePage() override;
327 bool validatePage() override;
328
329private:
330 void setupUI();
331
333 QLabel* instructionLabel_;
334 QComboBox* datasetSizeCombo_;
335 LeiEntityPicker* leiPicker_;
336 bool leiLoaded_ = false;
337};
338
343class TenantPartyOrganisationPage final : public QWizardPage {
344 Q_OBJECT
345
346private:
347 inline static std::string_view logger_name =
348 "ores.qt.tenant_party_organisation_page";
349
350 [[nodiscard]] static auto& lg() {
351 using namespace ores::logging;
352 static auto instance = make_logger(logger_name);
353 return instance;
354 }
355
356public:
358 void initializePage() override;
359 bool isComplete() const override;
360
361private:
362 void startPublish();
363 void startBundlePublish();
364 void startSyntheticGeneration();
365 void appendLog(const QString& message);
366
368 QLabel* statusLabel_;
369 QProgressBar* progressBar_;
370 QTextEdit* logOutput_;
371 bool publishComplete_ = false;
372 bool publishSuccess_ = false;
373};
374
378class TenantApplyAndSummaryPage final : public QWizardPage {
379 Q_OBJECT
380
381private:
382 inline static std::string_view logger_name =
383 "ores.qt.tenant_apply_and_summary_page";
384
385 [[nodiscard]] static auto& lg() {
386 using namespace ores::logging;
387 static auto instance = make_logger(logger_name);
388 return instance;
389 }
390
391public:
393 void initializePage() override;
394
395private:
396 void setupUI();
397
399 QLabel* summaryLabel_;
400};
401
402}
403
404#endif
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Model for displaying dataset bundles fetched from the server.
Definition ClientDatasetBundleModel.hpp:41
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:112
Reusable widget for searching and selecting an LEI entity.
Definition LeiEntityPicker.hpp:42
Wizard for first-time tenant setup after provisioning.
Definition TenantProvisioningWizard.hpp:64
void clearBootstrapFlag()
Clears the system.bootstrap_mode flag for the current tenant.
Definition TenantProvisioningWizard.cpp:95
Welcome page explaining what the provisioning wizard does.
Definition TenantProvisioningWizard.hpp:215
Page for selecting a dataset bundle to publish.
Definition TenantProvisioningWizard.hpp:229
Page for async publication of the selected bundle.
Definition TenantProvisioningWizard.hpp:252
Page for choosing GLEIF registry or synthetic data for party setup.
Definition TenantProvisioningWizard.hpp:285
Page for selecting a root LEI entity (GLEIF mode only).
Definition TenantProvisioningWizard.hpp:321
Page that publishes party hierarchy (GLEIF or synthetic) and associates the tenant admin with all cre...
Definition TenantProvisioningWizard.hpp:343
Final summary page that clears the bootstrap flag.
Definition TenantProvisioningWizard.hpp:378