20#ifndef ORES_QT_CLIENT_PAYMENT_FREQUENCY_TYPE_MODEL_HPP
21#define ORES_QT_CLIENT_PAYMENT_FREQUENCY_TYPE_MODEL_HPP
24#include <QFutureWatcher>
25#include <QAbstractTableModel>
26#include "ores.qt/ClientManager.hpp"
27#include "ores.qt/RecencyPulseManager.hpp"
28#include "ores.qt/RecencyTracker.hpp"
29#include "ores.logging/make_logger.hpp"
30#include "ores.trading.api/domain/payment_frequency_type.hpp"
44 inline static std::string_view logger_name =
45 "ores.qt.client_payment_frequency_type_model";
47 [[nodiscard]]
static auto& lg() {
49 static auto instance = make_logger(logger_name);
67 QObject* parent =
nullptr);
71 int rowCount(
const QModelIndex& parent = QModelIndex())
const override;
72 int columnCount(
const QModelIndex& parent = QModelIndex())
const override;
73 QVariant data(
const QModelIndex& index,
int role = Qt::DisplayRole)
const override;
74 QVariant headerData(
int section, Qt::Orientation orientation,
75 int role = Qt::DisplayRole)
const override;
93 void load_page(std::uint32_t offset, std::uint32_t limit);
98 std::uint32_t
page_size()
const {
return page_size_; }
119 void loadError(
const QString& error_message,
const QString& details = {});
122 void onTypesLoaded();
123 void onPulseStateChanged(
bool isOn);
124 void onPulsingComplete();
127 QVariant recency_foreground_color(
const std::string& code)
const;
131 std::vector<trading::domain::payment_frequency_type> types;
132 std::uint32_t total_available_count;
133 QString error_message;
134 QString error_details;
137 void fetch_types(std::uint32_t offset, std::uint32_t limit);
139 ClientManager* clientManager_;
140 std::vector<trading::domain::payment_frequency_type> types_;
141 QFutureWatcher<FetchResult>* watcher_;
142 std::uint32_t page_size_{100};
143 std::uint32_t total_available_count_{0};
144 bool is_fetching_{
false};
147 RecencyTracker<trading::domain::payment_frequency_type, PaymentFrequencyTypeKeyExtractor> recencyTracker_;
148 RecencyPulseManager* pulseManager_;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Model for displaying payment frequency types fetched from the server.
Definition ClientPaymentFrequencyTypeModel.hpp:40
void set_page_size(std::uint32_t size)
Set the page size for pagination.
Definition ClientPaymentFrequencyTypeModel.cpp:255
void refresh()
Refresh payment frequency type data from server asynchronously.
Definition ClientPaymentFrequencyTypeModel.cpp:123
std::uint32_t total_available_count() const
Get the total number of records available on the server.
Definition ClientPaymentFrequencyTypeModel.hpp:108
void dataLoaded()
Emitted when data has been successfully loaded.
void load_page(std::uint32_t offset, std::uint32_t limit)
Load a specific page of data.
Definition ClientPaymentFrequencyTypeModel.cpp:149
void loadError(const QString &error_message, const QString &details={})
Emitted when an error occurs during data loading.
std::uint32_t page_size() const
Get the page size used for pagination.
Definition ClientPaymentFrequencyTypeModel.hpp:98
const trading::domain::payment_frequency_type * getType(int row) const
Get payment frequency type at the specified row.
Definition ClientPaymentFrequencyTypeModel.cpp:267
Column
Enumeration of table columns for type-safe column access.
Definition ClientPaymentFrequencyTypeModel.hpp:57
Coupon or payment frequency code (e.g. Annual, Quarterly, Monthly).
Definition payment_frequency_type.hpp:35