19 draft.
id = snapshot.
id;
38 draft.
id = snapshot.
id;
79 auto statementDraft = std::make_shared<core::application::importing::draft::StatementDraft>(draft);
80 if (!statementDraft) {
84 if (statementDraft->id.empty()) {
89 [statementDraft](
const auto& item) {
90 return item && item->id == statementDraft->id;
95 *statementIt = statementDraft;
100 [statementDraft](
const auto& tx) {
101 return tx && tx->statementDraftId == statementDraft->id;
105 for (std::size_t i = 0; i < statementDraft->transactions.size(); ++i) {
106 auto tx = std::make_shared<core::application::importing::draft::TransactionDraft>(statementDraft->transactions[i]);
110 if (tx->id.empty()) {
113 tx->statementDraftId = statementDraft->id;
114 tx->position =
static_cast<int>(i);
120 if (draftId.empty()) {
128 [&draftId](
const auto& draft) {
129 return draft && draft->id == draftId;
135 [&draftId](
const auto& tx) {
136 return tx && tx->statementDraftId == draftId;
143 if (log.
id.empty()) {
146 auto next = std::make_shared<core::application::importing::ImportLog>(std::move(log));
148 [&next](
const auto& item) {
149 return item && next && item->id == next->id;
154 *it = std::move(next);
159 const std::string&
id) {
162 [&
id](
const auto& log) {
163 return log && log->id == id;
170 if (log.
id.empty()) {
173 auto next = std::make_shared<core::application::exporting::ExportLog>(std::move(log));
175 [&next](
const auto& item) {
176 return item && next && item->id == next->id;
181 *it = std::move(next);
186 const std::string&
id) {
189 [&
id](
const auto& log) {
190 return log && log->id == id;
200 : session_(&session) {
213void WorkspaceWorkflowService::commit() {
220 session_->notifyState();
227 session_->notifyState();
232 session_->notifyState();
237 session_->notifyState();
242 session_->notifyState();
247 session_->notifyState();
252 session_->notifyState();
Declares draft finalization helpers that materialize imported entities.
Declares private stable identifier helpers for core entity creation.
Draft statement model used by import finalization and core application flow.
Declares the mutable workspace session that ties in-memory state to storage.
Applies draft and log workflow commands to workspace session state.
Maintains the editable app state for one workspace and persists it through IStorageManager.
core::application::workspace::WorkspaceSessionState & mutableState() noexcept
void commit()
Persists the session when a file is open and notifies listeners.
void saveImportLog(const core::ports::workspace::ImportLogCommand &command)
Saves or updates one import log.
WorkspaceWorkflowService(WorkspaceSession &session)
Creates workflow service bound to one workspace session.
void deleteExportLog(const std::string &id)
Deletes one export log by id.
void saveExportLog(const core::ports::workspace::ExportLogCommand &command)
Saves or updates one export log.
std::string finalizeStatementDraft(const core::ports::workspace::FinalizeStatementDraftCommand &command)
Finalizes statement draft and returns created statement id.
void clearStatementDraft(const std::string &draftId={})
Clears one statement draft by id, or all drafts when id is empty.
void deleteImportLog(const std::string &id)
Deletes one import log by id.
void saveStatementDraft(const core::ports::workspace::StatementDraftCommand &command)
Saves or updates statement draft.
~WorkspaceWorkflowService()
Stores metadata about one export run for persistence and workflow tracking.
std::vector< std::string > annualIds
std::vector< std::string > analysisIds
Stores metadata about one import run for persistence and workflow tracking.
std::vector< std::string > statementDraftIds
static std::string finalize(core::domain::catalog::WorkspaceCatalog &state, const core::application::importing::draft::StatementDraft &draft)
Finalize a statement draft and append the resulting entities to the workspace state.
std::vector< TransactionDraft > transactions
std::vector< std::string > transactionIds
core::domain::Transaction::Status status
std::vector< uint8_t > proofImageData
std::vector< std::string > propertyIds
std::string statementDraftId
std::string makeStableId()
Generates a stable hex identifier for persisted entities.
WorkspaceWorkflowState workflow
TransactionDraftList transactionDrafts
StatementDraftList statementDrafts
std::vector< std::string > analysisIds
std::vector< std::string > annualIds
StatementDraftSnapshot draft
std::vector< std::string > statementDraftIds
StatementDraftSnapshot draft
std::vector< std::string > transactionIds
std::vector< TransactionDraftSnapshot > transactions
std::vector< std::string > propertyIds
std::string statementDraftId
std::vector< uint8_t > proofImageData