ORE Studio 0.0.4
Loading...
Searching...
No Matches
EntityDetailOperations.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_ENTITY_DETAIL_OPERATIONS_HPP
21#define ORES_QT_ENTITY_DETAIL_OPERATIONS_HPP
22
23#include <optional>
24#include <string>
25#include <vector>
26#include <boost/uuid/uuid.hpp>
27
28namespace ores::qt {
29
30class ClientManager;
31
35struct operation_result final {
36 bool success;
37 std::string message;
38};
39
43struct parent_entity_entry final {
44 boost::uuids::uuid id;
45 std::string short_code;
46 std::string full_name;
47 std::string status;
48 std::optional<boost::uuids::uuid> parent_id;
49};
50
54struct identifier_entry final {
55 boost::uuids::uuid id;
56 boost::uuids::uuid owner_id;
57 std::string id_scheme;
58 std::string id_value;
59 std::string description;
60 std::string modified_by;
61 std::string performed_by;
62};
63
67struct contact_entry final {
68 boost::uuids::uuid id;
69 boost::uuids::uuid owner_id;
70 std::string contact_type;
71 std::string street_line_1;
72 std::string street_line_2;
73 std::string city;
74 std::string state;
75 std::string country_code;
76 std::string postal_code;
77 std::string phone;
78 std::string email;
79 std::string web_page;
80 std::string modified_by;
81 std::string performed_by;
82};
83
90struct entity_data final {
91 int version = 0;
92 std::string tenant_id;
93 boost::uuids::uuid id;
94 std::string full_name;
95 std::string short_code;
96 std::optional<std::string> codename;
97 std::optional<std::string> transliterated_name;
98 std::optional<std::string> party_category;
99 std::string party_type;
100 std::optional<boost::uuids::uuid> parent_id;
101 std::string business_center_code;
102 std::string status;
103 std::string modified_by;
104 std::string performed_by;
105 std::string change_reason_code;
106 std::string change_commentary;
107 std::chrono::system_clock::time_point recorded_at;
108};
109
114 std::vector<parent_entity_entry> entities;
115 bool success;
116};
117
122 std::vector<identifier_entry> identifiers;
123 bool success;
124};
125
130 std::vector<contact_entry> contacts;
131 bool success;
132};
133
143public:
144 virtual ~entity_detail_operations() = default;
145
147 [[nodiscard]] virtual std::string entity_type_name() const = 0;
148
150 [[nodiscard]] virtual bool has_party_category() const = 0;
151
153 [[nodiscard]] virtual operation_result save_entity(
154 ClientManager* cm, const entity_data& data) const = 0;
155
157 [[nodiscard]] virtual operation_result delete_entity(
158 ClientManager* cm, const boost::uuids::uuid& id) const = 0;
159
162 ClientManager* cm) const = 0;
163
166 ClientManager* cm, const boost::uuids::uuid& entity_id) const = 0;
167
169 [[nodiscard]] virtual operation_result save_identifier(
170 ClientManager* cm, const identifier_entry& entry) const = 0;
171
173 [[nodiscard]] virtual operation_result delete_identifier(
174 ClientManager* cm, const boost::uuids::uuid& id) const = 0;
175
177 [[nodiscard]] virtual load_contacts_result load_contacts(
178 ClientManager* cm, const boost::uuids::uuid& entity_id) const = 0;
179
181 [[nodiscard]] virtual operation_result save_contact(
182 ClientManager* cm, const contact_entry& entry) const = 0;
183
185 [[nodiscard]] virtual operation_result delete_contact(
186 ClientManager* cm, const boost::uuids::uuid& id) const = 0;
187};
188
189}
190
191// Forward declarations for domain types used by conversion functions.
193struct counterparty;
194struct party;
195}
196
197namespace ores::qt {
198
202entity_data to_entity_data(const refdata::domain::counterparty& cpty);
203
207entity_data to_entity_data(const refdata::domain::party& party);
208
209}
210
211#endif
Qt-based graphical user interface for ORE Studio.
Definition AboutDialog.hpp:29
entity_data to_entity_data(const refdata::domain::counterparty &cpty)
Convert a counterparty domain object to entity_data.
Definition EntityDetailOperations.cpp:26
Domain types for risk management.
Definition EntityDetailOperations.hpp:192
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:109
Common result type for save and delete operations.
Definition EntityDetailOperations.hpp:35
Lightweight struct for populating parent entity combo boxes.
Definition EntityDetailOperations.hpp:43
Lightweight struct for populating identifier tables.
Definition EntityDetailOperations.hpp:54
boost::uuids::uuid owner_id
party_id or counterparty_id
Definition EntityDetailOperations.hpp:56
Lightweight struct for populating contact tables.
Definition EntityDetailOperations.hpp:67
boost::uuids::uuid owner_id
party_id or counterparty_id
Definition EntityDetailOperations.hpp:69
Common entity data extracted from party or counterparty types.
Definition EntityDetailOperations.hpp:90
std::optional< std::string > codename
Party-only field; immutable.
Definition EntityDetailOperations.hpp:96
std::optional< std::string > party_category
Party-only field.
Definition EntityDetailOperations.hpp:98
Result of loading all entities for hierarchy/parent combo.
Definition EntityDetailOperations.hpp:113
Result of loading identifiers for an entity.
Definition EntityDetailOperations.hpp:121
Result of loading contacts for an entity.
Definition EntityDetailOperations.hpp:129
Interface for entity-specific operations in the detail dialog.
Definition EntityDetailOperations.hpp:142
virtual std::string entity_type_name() const =0
Display name for the entity type (e.g. "Party", "Counterparty").
virtual bool has_party_category() const =0
Whether this entity type has a party_category field.
virtual operation_result save_contact(ClientManager *cm, const contact_entry &entry) const =0
Save a contact.
virtual operation_result delete_contact(ClientManager *cm, const boost::uuids::uuid &id) const =0
Delete a contact.
virtual operation_result save_entity(ClientManager *cm, const entity_data &data) const =0
Save the entity via protocol messages.
virtual operation_result delete_entity(ClientManager *cm, const boost::uuids::uuid &id) const =0
Delete the entity via protocol messages.
virtual load_identifiers_result load_identifiers(ClientManager *cm, const boost::uuids::uuid &entity_id) const =0
Load identifiers for a specific entity.
virtual operation_result save_identifier(ClientManager *cm, const identifier_entry &entry) const =0
Save an identifier.
virtual load_contacts_result load_contacts(ClientManager *cm, const boost::uuids::uuid &entity_id) const =0
Load contacts for a specific entity.
virtual operation_result delete_identifier(ClientManager *cm, const boost::uuids::uuid &id) const =0
Delete an identifier.
virtual load_all_entities_result load_all_entities(ClientManager *cm) const =0
Load all entities for parent combo and hierarchy tree.
An external trading partner participating in financial transactions.
Definition counterparty.hpp:37
An internal legal entity participating in financial transactions.
Definition party.hpp:37