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#include "ores.qt/export.hpp"
28
29namespace ores::qt {
30
31class ClientManager;
32
36struct operation_result final {
37 bool success;
38 std::string message;
39};
40
44struct parent_entity_entry final {
45 boost::uuids::uuid id;
46 std::string short_code;
47 std::string full_name;
48 std::string status;
49 std::optional<boost::uuids::uuid> parent_id;
50};
51
55struct identifier_entry final {
56 boost::uuids::uuid id;
57 boost::uuids::uuid owner_id;
58 std::string id_scheme;
59 std::string id_value;
60 std::string description;
61 std::string modified_by;
62 std::string performed_by;
63};
64
68struct contact_entry final {
69 boost::uuids::uuid id;
70 boost::uuids::uuid owner_id;
71 std::string contact_type;
72 std::string street_line_1;
73 std::string street_line_2;
74 std::string city;
75 std::string state;
76 std::string country_code;
77 std::string postal_code;
78 std::string phone;
79 std::string email;
80 std::string web_page;
81 std::string modified_by;
82 std::string performed_by;
83};
84
91struct entity_data final {
92 int version = 0;
93 std::string tenant_id;
94 boost::uuids::uuid id;
95 std::string full_name;
96 std::string short_code;
97 std::optional<std::string> codename;
98 std::optional<std::string> transliterated_name;
99 std::optional<std::string> party_category;
100 std::string party_type;
101 std::optional<boost::uuids::uuid> parent_id;
102 std::string business_center_code;
103 std::string status;
104 std::string modified_by;
105 std::string performed_by;
106 std::string change_reason_code;
107 std::string change_commentary;
108 std::chrono::system_clock::time_point recorded_at;
109};
110
115 std::vector<parent_entity_entry> entities;
116 bool success;
117};
118
123 std::vector<identifier_entry> identifiers;
124 bool success;
125};
126
131 std::vector<contact_entry> contacts;
132 bool success;
133};
134
143class ORES_QT_API entity_detail_operations {
144public:
145 virtual ~entity_detail_operations() = default;
146
148 [[nodiscard]] virtual std::string entity_type_name() const = 0;
149
151 [[nodiscard]] virtual bool has_party_category() const = 0;
152
154 [[nodiscard]] virtual operation_result save_entity(
155 ClientManager* cm, const entity_data& data) const = 0;
156
158 [[nodiscard]] virtual operation_result delete_entity(
159 ClientManager* cm, const boost::uuids::uuid& id) const = 0;
160
163 ClientManager* cm) const = 0;
164
167 ClientManager* cm, const boost::uuids::uuid& entity_id) const = 0;
168
170 [[nodiscard]] virtual operation_result save_identifier(
171 ClientManager* cm, const identifier_entry& entry) const = 0;
172
174 [[nodiscard]] virtual operation_result delete_identifier(
175 ClientManager* cm, const boost::uuids::uuid& id) const = 0;
176
178 [[nodiscard]] virtual load_contacts_result load_contacts(
179 ClientManager* cm, const boost::uuids::uuid& entity_id) const = 0;
180
182 [[nodiscard]] virtual operation_result save_contact(
183 ClientManager* cm, const contact_entry& entry) const = 0;
184
186 [[nodiscard]] virtual operation_result delete_contact(
187 ClientManager* cm, const boost::uuids::uuid& id) const = 0;
188};
189
190}
191
192// Forward declarations for domain types used by conversion functions.
194struct counterparty;
195struct party;
196}
197
198namespace ores::qt {
199
203ORES_QT_API entity_data to_entity_data(const refdata::domain::counterparty& cpty);
204
208ORES_QT_API entity_data to_entity_data(const refdata::domain::party& party);
209
210}
211
212#endif
Qt-based graphical user interface for ORE Studio.
Definition AccountController.hpp:32
ORES_QT_API 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:193
Manages the lifecycle of the NATS client and login state.
Definition ClientManager.hpp:123
Common result type for save and delete operations.
Definition EntityDetailOperations.hpp:36
Lightweight struct for populating parent entity combo boxes.
Definition EntityDetailOperations.hpp:44
Lightweight struct for populating identifier tables.
Definition EntityDetailOperations.hpp:55
boost::uuids::uuid owner_id
party_id or counterparty_id
Definition EntityDetailOperations.hpp:57
Lightweight struct for populating contact tables.
Definition EntityDetailOperations.hpp:68
boost::uuids::uuid owner_id
party_id or counterparty_id
Definition EntityDetailOperations.hpp:70
Common entity data extracted from party or counterparty types.
Definition EntityDetailOperations.hpp:91
std::optional< std::string > codename
Party-only field; immutable.
Definition EntityDetailOperations.hpp:97
std::optional< std::string > party_category
Party-only field.
Definition EntityDetailOperations.hpp:99
Result of loading all entities for hierarchy/parent combo.
Definition EntityDetailOperations.hpp:114
Result of loading identifiers for an entity.
Definition EntityDetailOperations.hpp:122
Result of loading contacts for an entity.
Definition EntityDetailOperations.hpp:130
Interface for entity-specific operations in the detail dialog.
Definition EntityDetailOperations.hpp:143
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