ORE Studio 0.0.4
Loading...
Searching...
No Matches
change_management_protocol.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 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_DQ_MESSAGING_CHANGE_MANAGEMENT_PROTOCOL_HPP
21#define ORES_DQ_MESSAGING_CHANGE_MANAGEMENT_PROTOCOL_HPP
22
23#include <span>
24#include <iosfwd>
25#include <vector>
26#include <expected>
27#include "ores.comms/messaging/message_types.hpp"
28#include "ores.comms/messaging/message_traits.hpp"
29#include "ores.dq/domain/change_reason_category.hpp"
30#include "ores.dq/domain/change_reason.hpp"
31
32namespace ores::dq::messaging {
33
38 std::vector<std::byte> serialize() const;
39 static std::expected<get_change_reason_categories_request,
40 ores::utility::serialization::error_code>
41 deserialize(std::span<const std::byte> data);
42};
43
44std::ostream& operator<<(std::ostream& s,
46
51 std::vector<domain::change_reason_category> categories;
52
53 std::vector<std::byte> serialize() const;
54 static std::expected<get_change_reason_categories_response,
55 ores::utility::serialization::error_code>
56 deserialize(std::span<const std::byte> data);
57};
58
59std::ostream& operator<<(std::ostream& s,
61
66 std::vector<std::byte> serialize() const;
67 static std::expected<get_change_reasons_request,
68 ores::utility::serialization::error_code>
69 deserialize(std::span<const std::byte> data);
70};
71
72std::ostream& operator<<(std::ostream& s,
74
79 std::vector<domain::change_reason> reasons;
80
81 std::vector<std::byte> serialize() const;
82 static std::expected<get_change_reasons_response,
83 ores::utility::serialization::error_code>
84 deserialize(std::span<const std::byte> data);
85};
86
87std::ostream& operator<<(std::ostream& s,
89
94 std::string category_code;
95
96 std::vector<std::byte> serialize() const;
97 static std::expected<get_change_reasons_by_category_request,
98 ores::utility::serialization::error_code>
99 deserialize(std::span<const std::byte> data);
100};
101
102std::ostream& operator<<(std::ostream& s,
104
109 std::vector<domain::change_reason> reasons;
110
111 std::vector<std::byte> serialize() const;
112 static std::expected<get_change_reasons_by_category_response,
113 ores::utility::serialization::error_code>
114 deserialize(std::span<const std::byte> data);
115};
116
117std::ostream& operator<<(std::ostream& s,
119
120// ============================================================================
121// Change Reason CRUD Operations
122// ============================================================================
123
133
134 std::vector<std::byte> serialize() const;
135 static std::expected<save_change_reason_request,
136 ores::utility::serialization::error_code>
137 deserialize(std::span<const std::byte> data);
138};
139
140std::ostream& operator<<(std::ostream& s, const save_change_reason_request& v);
141
146 bool success;
147 std::string message;
148
149 std::vector<std::byte> serialize() const;
150 static std::expected<save_change_reason_response,
151 ores::utility::serialization::error_code>
152 deserialize(std::span<const std::byte> data);
153};
154
155std::ostream& operator<<(std::ostream& s, const save_change_reason_response& v);
156
161 std::string code;
162 bool success;
163 std::string message;
164};
165
166std::ostream& operator<<(std::ostream& s, const delete_change_reason_result& v);
167
175 std::vector<std::string> codes;
176
177 std::vector<std::byte> serialize() const;
178 static std::expected<delete_change_reason_request,
179 ores::utility::serialization::error_code>
180 deserialize(std::span<const std::byte> data);
181};
182
183std::ostream& operator<<(std::ostream& s, const delete_change_reason_request& v);
184
192 std::vector<delete_change_reason_result> results;
193
194 std::vector<std::byte> serialize() const;
195 static std::expected<delete_change_reason_response,
196 ores::utility::serialization::error_code>
197 deserialize(std::span<const std::byte> data);
198};
199
200std::ostream& operator<<(std::ostream& s, const delete_change_reason_response& v);
201
206 std::string code;
207
208 std::vector<std::byte> serialize() const;
209 static std::expected<get_change_reason_history_request,
210 ores::utility::serialization::error_code>
211 deserialize(std::span<const std::byte> data);
212};
213
214std::ostream& operator<<(std::ostream& s,
216
221 bool success;
222 std::string message;
223 std::vector<domain::change_reason> versions;
224
225 std::vector<std::byte> serialize() const;
226 static std::expected<get_change_reason_history_response,
227 ores::utility::serialization::error_code>
228 deserialize(std::span<const std::byte> data);
229};
230
231std::ostream& operator<<(std::ostream& s,
233
234// ============================================================================
235// Change Reason Category CRUD Operations
236// ============================================================================
237
247
248 std::vector<std::byte> serialize() const;
249 static std::expected<save_change_reason_category_request,
250 ores::utility::serialization::error_code>
251 deserialize(std::span<const std::byte> data);
252};
253
254std::ostream& operator<<(std::ostream& s,
256
261 bool success;
262 std::string message;
263
264 std::vector<std::byte> serialize() const;
265 static std::expected<save_change_reason_category_response,
266 ores::utility::serialization::error_code>
267 deserialize(std::span<const std::byte> data);
268};
269
270std::ostream& operator<<(std::ostream& s,
272
277 std::string code;
278 bool success;
279 std::string message;
280};
281
282std::ostream& operator<<(std::ostream& s,
284
292 std::vector<std::string> codes;
293
294 std::vector<std::byte> serialize() const;
295 static std::expected<delete_change_reason_category_request,
296 ores::utility::serialization::error_code>
297 deserialize(std::span<const std::byte> data);
298};
299
300std::ostream& operator<<(std::ostream& s,
302
310 std::vector<delete_change_reason_category_result> results;
311
312 std::vector<std::byte> serialize() const;
313 static std::expected<delete_change_reason_category_response,
314 ores::utility::serialization::error_code>
315 deserialize(std::span<const std::byte> data);
316};
317
318std::ostream& operator<<(std::ostream& s,
320
325 std::string code;
326
327 std::vector<std::byte> serialize() const;
329 ores::utility::serialization::error_code>
330 deserialize(std::span<const std::byte> data);
331};
332
333std::ostream& operator<<(std::ostream& s,
335
340 bool success;
341 std::string message;
342 std::vector<domain::change_reason_category> versions;
343
344 std::vector<std::byte> serialize() const;
346 ores::utility::serialization::error_code>
347 deserialize(std::span<const std::byte> data);
348};
349
350std::ostream& operator<<(std::ostream& s,
352
353}
354
355namespace ores::comms::messaging {
356
360template<>
361struct message_traits<dq::messaging::get_change_reason_categories_request> {
364 static constexpr message_type request_message_type =
365 message_type::get_change_reason_categories_request;
366};
367
371template<>
372struct message_traits<dq::messaging::get_change_reasons_request> {
375 static constexpr message_type request_message_type =
376 message_type::get_change_reasons_request;
377};
378
382template<>
383struct message_traits<dq::messaging::get_change_reasons_by_category_request> {
386 static constexpr message_type request_message_type =
387 message_type::get_change_reasons_by_category_request;
388};
389
393template<>
394struct message_traits<dq::messaging::save_change_reason_request> {
397 static constexpr message_type request_message_type =
398 message_type::save_change_reason_request;
399};
400
404template<>
405struct message_traits<dq::messaging::delete_change_reason_request> {
408 static constexpr message_type request_message_type =
409 message_type::delete_change_reason_request;
410};
411
415template<>
416struct message_traits<dq::messaging::get_change_reason_history_request> {
419 static constexpr message_type request_message_type =
420 message_type::get_change_reason_history_request;
421};
422
426template<>
427struct message_traits<dq::messaging::save_change_reason_category_request> {
430 static constexpr message_type request_message_type =
431 message_type::save_change_reason_category_request;
432};
433
437template<>
438struct message_traits<dq::messaging::delete_change_reason_category_request> {
441 static constexpr message_type request_message_type =
442 message_type::delete_change_reason_category_request;
443};
444
448template<>
449struct message_traits<dq::messaging::get_change_reason_category_history_request> {
452 static constexpr message_type request_message_type =
453 message_type::get_change_reason_category_history_request;
454};
455
456}
457
458#endif
Contains messaging related infrastructure in the comms library.
Definition assets_protocol.hpp:122
Traits template for mapping request types to their response types and message type enum values.
Definition message_traits.hpp:66
Defines a specific reason for record changes.
Definition change_reason.hpp:47
Groups change reasons into logical categories.
Definition change_reason_category.hpp:45
Request to retrieve all change reason categories.
Definition change_management_protocol.hpp:37
Response containing all change reason categories.
Definition change_management_protocol.hpp:50
Request to retrieve all change reasons.
Definition change_management_protocol.hpp:65
Response containing all change reasons.
Definition change_management_protocol.hpp:78
Request to retrieve change reasons for a specific category.
Definition change_management_protocol.hpp:93
Response containing change reasons for a category.
Definition change_management_protocol.hpp:108
Request to save a change reason (create or update).
Definition change_management_protocol.hpp:131
Response confirming change reason save operation.
Definition change_management_protocol.hpp:145
Result for a single change reason deletion.
Definition change_management_protocol.hpp:160
Request to delete one or more change reasons.
Definition change_management_protocol.hpp:174
Response confirming change reason deletion(s).
Definition change_management_protocol.hpp:191
Request to retrieve version history for a change reason.
Definition change_management_protocol.hpp:205
Response containing change reason version history.
Definition change_management_protocol.hpp:220
Request to save a change reason category (create or update).
Definition change_management_protocol.hpp:245
Response confirming change reason category save operation.
Definition change_management_protocol.hpp:260
Result for a single change reason category deletion.
Definition change_management_protocol.hpp:276
Request to delete one or more change reason categories.
Definition change_management_protocol.hpp:291
Response confirming change reason category deletion(s).
Definition change_management_protocol.hpp:309
Request to retrieve version history for a change reason category.
Definition change_management_protocol.hpp:324
Response containing change reason category version history.
Definition change_management_protocol.hpp:339