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 <QComboBox>
26#include <QLabel>
27#include <QLineEdit>
28#include <QProgressBar>
29#include <QRadioButton>
30#include <QSpinBox>
31#include <QCheckBox>
32#include <QTextEdit>
33#include <QPushButton>
34#include <QListWidget>
35#include <optional>
36#include <cstdint>
37#include <vector>
38#include <string>
39#include "ores.logging/make_logger.hpp"
40#include "ores.qt/ClientManager.hpp"
41
42namespace ores::qt {
43
44class ClientDatasetBundleModel;
45class LeiEntityPicker;
46
65class TenantProvisioningWizard final : public QWizard {
66 Q_OBJECT
67
68private:
69 inline static std::string_view logger_name =
70 "ores.qt.tenant_provisioning_wizard";
71
72 [[nodiscard]] static auto& lg() {
73 using namespace ores::logging;
74 static auto instance = make_logger(logger_name);
75 return instance;
76 }
77
78public:
79 enum PageId {
80 Page_Welcome,
81 Page_BundleSelection,
82 Page_BundleInstall,
83 Page_DataSourceSelection,
84 Page_PartySetup,
85 Page_CounterpartySetup,
86 Page_OrganisationSetup,
87 Page_ReportSetup,
88 Page_ReportInstall,
89 Page_Summary
90 };
91
95 struct ReportSpec {
96 std::string name;
97 std::string description;
98 std::string schedule_expression;
99 std::string report_type;
100 std::string concurrency_policy;
101 };
102
103 enum class DataSourceMode {
104 gleif,
105 synthetic
106 };
107
109 ClientManager* clientManager,
110 QWidget* parent = nullptr);
111
112 ~TenantProvisioningWizard() override = default;
113
114 ClientManager* clientManager() const { return clientManager_; }
115
116 QString selectedBundleCode() const { return selectedBundleCode_; }
117 void setSelectedBundleCode(const QString& code) { selectedBundleCode_ = code; }
118
119 QString selectedBundleName() const { return selectedBundleName_; }
120 void setSelectedBundleName(const QString& name) { selectedBundleName_ = name; }
121
122 QString rootLei() const { return rootLei_; }
123 void setRootLei(const QString& lei) { rootLei_ = lei; }
124
125 QString rootLeiName() const { return rootLeiName_; }
126 void setRootLeiName(const QString& name) { rootLeiName_ = name; }
127
128 QString leiDatasetSize() const { return leiDatasetSize_; }
129 void setLeiDatasetSize(const QString& size) { leiDatasetSize_ = size; }
130
131 bool organisationPublished() const { return organisationPublished_; }
132 void setOrganisationPublished(bool v) { organisationPublished_ = v; }
133
134 DataSourceMode dataSourceMode() const { return dataSourceMode_; }
135 void setDataSourceMode(DataSourceMode m) { dataSourceMode_ = m; }
136
137 // --- Synthetic generation options (set by DataSourceSelectionPage) ---
138
139 QString syntheticCountry() const { return syntheticCountry_; }
140 void setSyntheticCountry(const QString& c) { syntheticCountry_ = c; }
141
142 int syntheticPartyCount() const { return syntheticPartyCount_; }
143 void setSyntheticPartyCount(int c) { syntheticPartyCount_ = c; }
144
145 int syntheticPartyMaxDepth() const { return syntheticPartyMaxDepth_; }
146 void setSyntheticPartyMaxDepth(int d) { syntheticPartyMaxDepth_ = d; }
147
148 int syntheticCounterpartyCount() const { return syntheticCounterpartyCount_; }
149 void setSyntheticCounterpartyCount(int c) { syntheticCounterpartyCount_ = c; }
150
151 int syntheticCounterpartyMaxDepth() const { return syntheticCounterpartyMaxDepth_; }
152 void setSyntheticCounterpartyMaxDepth(int d) { syntheticCounterpartyMaxDepth_ = d; }
153
154 int syntheticPortfolioLeafCount() const { return syntheticPortfolioLeafCount_; }
155 void setSyntheticPortfolioLeafCount(int c) { syntheticPortfolioLeafCount_ = c; }
156
157 int syntheticPortfolioMaxDepth() const { return syntheticPortfolioMaxDepth_; }
158 void setSyntheticPortfolioMaxDepth(int d) { syntheticPortfolioMaxDepth_ = d; }
159
160 int syntheticBooksPerPortfolio() const { return syntheticBooksPerPortfolio_; }
161 void setSyntheticBooksPerPortfolio(int c) { syntheticBooksPerPortfolio_ = c; }
162
163 int syntheticBusinessUnitCount() const { return syntheticBusinessUnitCount_; }
164 void setSyntheticBusinessUnitCount(int c) { syntheticBusinessUnitCount_ = c; }
165
166 int syntheticBusinessUnitMaxDepth() const { return syntheticBusinessUnitMaxDepth_; }
167 void setSyntheticBusinessUnitMaxDepth(int d) { syntheticBusinessUnitMaxDepth_ = d; }
168
169 bool syntheticGenerateAddresses() const { return syntheticGenerateAddresses_; }
170 void setSyntheticGenerateAddresses(bool v) { syntheticGenerateAddresses_ = v; }
171
172 int syntheticContactsPerParty() const { return syntheticContactsPerParty_; }
173 void setSyntheticContactsPerParty(int c) { syntheticContactsPerParty_ = c; }
174
175 int syntheticContactsPerCounterparty() const { return syntheticContactsPerCounterparty_; }
176 void setSyntheticContactsPerCounterparty(int c) { syntheticContactsPerCounterparty_ = c; }
177
178 bool syntheticGenerateIdentifiers() const { return syntheticGenerateIdentifiers_; }
179 void setSyntheticGenerateIdentifiers(bool v) { syntheticGenerateIdentifiers_ = v; }
180
181 std::optional<std::uint64_t> syntheticSeed() const { return syntheticSeed_; }
182 void setSyntheticSeed(std::optional<std::uint64_t> s) { syntheticSeed_ = s; }
183
184 std::vector<ReportSpec> selectedReports() const { return selectedReports_; }
185 void setSelectedReports(std::vector<ReportSpec> r) { selectedReports_ = std::move(r); }
186
190 void clearBootstrapFlag();
191
192signals:
193 void provisioningCompleted();
194
195private:
196 void setupPages();
197
198 ClientManager* clientManager_;
199 QString selectedBundleCode_;
200 QString selectedBundleName_;
201 QString rootLei_;
202 QString rootLeiName_;
203 QString leiDatasetSize_ = "large";
204 bool organisationPublished_ = false;
205 DataSourceMode dataSourceMode_ = DataSourceMode::gleif;
206
207 // Synthetic generation options
208 QString syntheticCountry_ = "GB";
209 int syntheticPartyCount_ = 5;
210 int syntheticPartyMaxDepth_ = 3;
211 int syntheticCounterpartyCount_ = 10;
212 int syntheticCounterpartyMaxDepth_ = 3;
213 int syntheticPortfolioLeafCount_ = 8;
214 int syntheticPortfolioMaxDepth_ = 4;
215 int syntheticBooksPerPortfolio_ = 2;
216 int syntheticBusinessUnitCount_ = 10;
217 int syntheticBusinessUnitMaxDepth_ = 2;
218 bool syntheticGenerateAddresses_ = true;
219 int syntheticContactsPerParty_ = 2;
220 int syntheticContactsPerCounterparty_ = 1;
221 bool syntheticGenerateIdentifiers_ = true;
222 std::optional<std::uint64_t> syntheticSeed_;
223
224 std::vector<ReportSpec> selectedReports_;
225};
226
227// Forward declarations
228class ProvisioningWelcomePage;
229class BundleSelectionPage;
230class BundleInstallPage;
231class DataSourceSelectionPage;
232class PartySetupPage;
233class CounterpartySetupPage;
234class OrganisationSetupPage;
235class ReportSetupPage;
236class ReportInstallPage;
237class ApplyAndSummaryPage;
238
242class ProvisioningWelcomePage final : public QWizardPage {
243 Q_OBJECT
244
245public:
247
248private:
249 void setupUI();
251};
252
256class BundleSelectionPage final : public QWizardPage {
257 Q_OBJECT
258
259public:
261 void initializePage() override;
262 bool validatePage() override;
263 bool isComplete() const override;
264
265private:
266 void setupUI();
267 void onBundleChanged(int index);
268
270 ClientDatasetBundleModel* bundleModel_;
271 QComboBox* bundleCombo_;
272 QLabel* descriptionLabel_;
273 QLabel* statusLabel_;
274};
275
279class BundleInstallPage final : public QWizardPage {
280 Q_OBJECT
281
282private:
283 inline static std::string_view logger_name =
284 "ores.qt.bundle_install_page";
285
286 [[nodiscard]] static auto& lg() {
287 using namespace ores::logging;
288 static auto instance = make_logger(logger_name);
289 return instance;
290 }
291
292public:
294 void initializePage() override;
295 bool isComplete() const override;
296
297private:
298 void startPublish();
299 void appendLog(const QString& message);
300
302 QLabel* statusLabel_;
303 QProgressBar* progressBar_;
304 QTextEdit* logOutput_;
305 bool publishComplete_ = false;
306 bool publishSuccess_ = false;
307};
308
316class DataSourceSelectionPage final : public QWizardPage {
317 Q_OBJECT
318
319public:
321 bool validatePage() override;
322 int nextId() const override;
323
324private:
325 void setupUI();
326 void onModeChanged();
327
329 QRadioButton* gleifRadio_;
330 QRadioButton* syntheticRadio_;
331 QWidget* syntheticOptions_;
332
333 // Basic counts
334 QComboBox* countryCombo_;
335 QSpinBox* partyCountSpin_;
336 QSpinBox* counterpartyCountSpin_;
337 QSpinBox* portfolioLeafCountSpin_;
338 QSpinBox* booksPerPortfolioSpin_;
339 QSpinBox* businessUnitCountSpin_;
340
341 // Hierarchy depths
342 QSpinBox* partyMaxDepthSpin_;
343 QSpinBox* counterpartyMaxDepthSpin_;
344 QSpinBox* portfolioMaxDepthSpin_;
345 QSpinBox* businessUnitMaxDepthSpin_;
346
347 // Contact and identifier options
348 QSpinBox* contactsPerPartySpin_;
349 QSpinBox* contactsPerCounterpartySpin_;
350 QCheckBox* generateAddressesCheck_;
351 QCheckBox* generateIdentifiersCheck_;
352
353 // Reproducibility
354 QLineEdit* seedEdit_;
355};
356
360class PartySetupPage final : public QWizardPage {
361 Q_OBJECT
362
363public:
365 void initializePage() override;
366 bool validatePage() override;
367
368private:
369 void setupUI();
370
372 LeiEntityPicker* leiPicker_;
373 QComboBox* datasetSizeCombo_;
374 QLabel* instructionLabel_;
375 bool leiLoaded_ = false;
376};
377
381class CounterpartySetupPage final : public QWizardPage {
382 Q_OBJECT
383
384public:
386
387private:
388 void setupUI();
390};
391
398class OrganisationSetupPage final : public QWizardPage {
399 Q_OBJECT
400
401private:
402 inline static std::string_view logger_name =
403 "ores.qt.organisation_setup_page";
404
405 [[nodiscard]] static auto& lg() {
406 using namespace ores::logging;
407 static auto instance = make_logger(logger_name);
408 return instance;
409 }
410
411public:
413 void initializePage() override;
414 bool isComplete() const override;
415
416private:
417 void startPublish();
418 void startBundlePublish();
419 void startSyntheticGeneration();
420 void appendLog(const QString& message);
421
423 QLabel* statusLabel_;
424 QProgressBar* progressBar_;
425 QTextEdit* logOutput_;
426 bool publishComplete_ = false;
427 bool publishSuccess_ = false;
428};
429
438class ReportSetupPage final : public QWizardPage {
439 Q_OBJECT
440
441public:
443 bool validatePage() override;
444 int nextId() const override;
445
446private:
447 void setupUI();
448
450 QListWidget* reportList_;
451};
452
460class ReportInstallPage final : public QWizardPage {
461 Q_OBJECT
462
463private:
464 inline static std::string_view logger_name =
465 "ores.qt.report_install_page";
466
467 [[nodiscard]] static auto& lg() {
468 using namespace ores::logging;
469 static auto instance = make_logger(logger_name);
470 return instance;
471 }
472
473public:
475 void initializePage() override;
476 bool isComplete() const override;
477
478private:
479 void startInstall();
480 void appendLog(const QString& message);
481
483 QLabel* statusLabel_;
484 QProgressBar* progressBar_;
485 QTextEdit* logOutput_;
486 bool installComplete_ = false;
487 bool installSuccess_ = false;
488};
489
493class ApplyAndSummaryPage final : public QWizardPage {
494 Q_OBJECT
495
496private:
497 inline static std::string_view logger_name =
498 "ores.qt.apply_and_summary_page";
499
500 [[nodiscard]] static auto& lg() {
501 using namespace ores::logging;
502 static auto instance = make_logger(logger_name);
503 return instance;
504 }
505
506public:
508 void initializePage() override;
509
510private:
511 void setupUI();
512
514 QLabel* summaryLabel_;
515};
516
517}
518
519#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:109
Reusable widget for searching and selecting an LEI entity.
Definition LeiEntityPicker.hpp:42
Wizard for first-time tenant setup after provisioning.
Definition TenantProvisioningWizard.hpp:65
void clearBootstrapFlag()
Clears the system.bootstrap_mode flag for the current tenant.
Definition TenantProvisioningWizard.cpp:96
Specification for an initial report definition to create during provisioning.
Definition TenantProvisioningWizard.hpp:95
Welcome page explaining what the provisioning wizard does.
Definition TenantProvisioningWizard.hpp:242
Page for selecting a dataset bundle to publish.
Definition TenantProvisioningWizard.hpp:256
Page for async publication of the selected bundle.
Definition TenantProvisioningWizard.hpp:279
Page for choosing between GLEIF registry and synthetic data generation.
Definition TenantProvisioningWizard.hpp:316
Page for optional root party selection via LEI entity picker.
Definition TenantProvisioningWizard.hpp:360
Informational page about counterparty import (placeholder).
Definition TenantProvisioningWizard.hpp:381
Page for async publication of the organisation dataset bundle.
Definition TenantProvisioningWizard.hpp:398
Page for selecting which initial report definitions to create.
Definition TenantProvisioningWizard.hpp:438
Page that asynchronously creates the selected report definitions.
Definition TenantProvisioningWizard.hpp:460
Final summary page that clears the bootstrap flag.
Definition TenantProvisioningWizard.hpp:493