20#ifndef ORES_IAM_MESSAGING_ACCOUNT_PROTOCOL_HPP
21#define ORES_IAM_MESSAGING_ACCOUNT_PROTOCOL_HPP
25#include "ores.iam.api/domain/account.hpp"
26#include "ores.iam.api/domain/login_info.hpp"
28namespace ores::iam::messaging {
30struct get_accounts_request {
35struct get_accounts_response {
36 std::vector<ores::iam::domain::account> accounts;
37 int total_available_count = 0;
40struct save_account_request {
41 using response_type =
struct save_account_response;
42 static constexpr std::string_view nats_subject =
"iam.v1.accounts.save";
43 std::string principal;
45 std::string totp_secret;
47 std::string account_type;
50struct update_account_request {
51 using response_type =
struct update_account_response;
52 static constexpr std::string_view nats_subject =
"iam.v1.accounts.update";
53 std::string account_id;
55 std::string change_reason_code;
56 std::string change_commentary;
59struct update_account_response {
64struct save_account_response {
67 std::string account_id;
70struct delete_account_request {
71 using response_type =
struct delete_account_response;
72 static constexpr std::string_view nats_subject =
"iam.v1.accounts.delete";
73 std::string account_id;
76struct delete_account_response {
81struct account_operation_result {
86struct lock_account_request {
87 using response_type =
struct lock_account_response;
88 static constexpr std::string_view nats_subject =
"iam.v1.accounts.lock";
89 std::vector<std::string> account_ids;
92struct lock_account_response {
93 std::vector<account_operation_result> results;
96struct unlock_account_request {
97 using response_type =
struct unlock_account_response;
98 static constexpr std::string_view nats_subject =
"iam.v1.accounts.unlock";
99 std::vector<std::string> account_ids;
102struct unlock_account_response {
103 std::vector<account_operation_result> results;
106struct list_login_info_request {
107 using response_type =
struct list_login_info_response;
108 static constexpr std::string_view nats_subject =
"iam.v1.accounts.login-info";
111struct list_login_info_response {
112 std::vector<ores::iam::domain::login_info> login_infos;
115struct reset_password_request {
116 using response_type =
struct reset_password_response;
117 static constexpr std::string_view nats_subject =
"iam.v1.accounts.reset-password";
118 std::vector<std::string> account_ids;
119 std::string new_password;
122struct reset_password_response {
123 bool success =
false;
125 std::vector<account_operation_result> results;
128struct change_password_request {
129 std::string current_password;
130 std::string new_password;
133struct change_password_response {
134 bool success =
false;
138struct update_my_email_request {
139 using response_type =
struct update_my_email_response;
140 static constexpr std::string_view nats_subject =
"iam.v1.accounts.update-email";
144struct update_my_email_response {
145 bool success =
false;
149struct select_party_request {
150 using response_type =
struct select_party_response;
151 static constexpr std::string_view nats_subject =
"iam.v1.accounts.select-party";
152 std::string party_id;
155struct select_party_response {
156 bool success =
false;
159 std::string username;
160 std::string tenant_name;
161 std::string party_name;
167 int access_lifetime_s = 1800;
170struct get_accounts_request_typed {
171 using response_type =
struct get_accounts_response;
172 static constexpr std::string_view nats_subject =
"iam.v1.accounts.list";
177struct change_password_request_typed {
178 using response_type =
struct change_password_response;
179 static constexpr std::string_view nats_subject =
"iam.v1.accounts.change-password";
180 std::string current_password;
181 std::string new_password;