FOSSredder 0.5.0
Loading...
Searching...
No Matches
IWorkspaceWriter.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include <functional>
9#include <string>
10
15
16namespace core::ports::workspace {
17
22public:
23 using SnapshotChanged = std::function<void(const WorkspaceSnapshot&)>;
24 using DeletionImpactCallback = std::function<void(const DeletionImpact&)>;
25
29 virtual ~IWorkspaceWriter() = default;
30
40 virtual void setErrorReporter(std::shared_ptr<core::ports::diagnostics::IErrorReporter> reporter) = 0;
56
58 virtual void openLatest() = 0;
63 virtual void newFile(const std::string& path) = 0;
68 virtual void openFile(const std::string& path) = 0;
70 virtual void saveFile() = 0;
75 virtual void saveFileAs(const std::string& path) = 0;
77 virtual void commit() = 0;
79 virtual void notifySnapshot() = 0;
80
86 [[nodiscard]] virtual ValidationResult validateActor(const ActorCommand& command) const = 0;
92 [[nodiscard]] virtual ValidationResult validateProperty(const PropertyCommand& command) const = 0;
98 [[nodiscard]] virtual ValidationResult validateContract(const ContractCommand& command) const = 0;
104 [[nodiscard]] virtual ValidationResult validateStatement(const StatementCommand& command) const = 0;
110 [[nodiscard]] virtual ValidationResult validateTransaction(const TransactionCommand& command) const = 0;
122 [[nodiscard]] virtual ValidationResult validateAnalysis(const AnalysisCommand& command) const = 0;
128 [[nodiscard]] virtual ValidationResult validateAnnual(const AnnualCommand& command) const = 0;
129
135 [[nodiscard]] virtual std::string addActor(const ActorCommand& command) = 0;
140 virtual void updateActor(const ActorCommand& command) = 0;
145 virtual void deleteActor(const std::string& id) = 0;
146
152 [[nodiscard]] virtual std::string addProperty(const PropertyCommand& command) = 0;
157 virtual void updateProperty(const PropertyCommand& command) = 0;
162 virtual void deleteProperty(const std::string& id) = 0;
163
169 [[nodiscard]] virtual std::string addContract(const ContractCommand& command) = 0;
174 virtual void updateContract(const ContractCommand& command) = 0;
179 virtual void deleteContract(const std::string& id) = 0;
180
186 [[nodiscard]] virtual std::string addStatement(const StatementCommand& command) = 0;
192 [[nodiscard]] virtual std::string addStatementWithTransactions(const StatementWithTransactionsCommand& command) = 0;
197 virtual void updateStatement(const StatementCommand& command) = 0;
202 virtual void deleteStatement(const std::string& id) = 0;
203
209 [[nodiscard]] virtual std::string addTransaction(const TransactionCommand& command) = 0;
214 virtual void updateTransaction(const TransactionCommand& command) = 0;
219 virtual void deleteTransaction(const std::string& id) = 0;
220
226 [[nodiscard]] virtual std::string addAnalysis(const AnalysisCommand& command) = 0;
231 virtual void updateAnalysis(const AnalysisCommand& command) = 0;
236 virtual void deleteAnalysis(const std::string& id) = 0;
237
243 [[nodiscard]] virtual std::string addAnnual(const AnnualCommand& command) = 0;
248 virtual void updateAnnual(const AnnualCommand& command) = 0;
253 virtual void deleteAnnual(const std::string& id) = 0;
254
260 [[nodiscard]] virtual std::string finalizeStatementDraft(const FinalizeStatementDraftCommand& command) = 0;
265 virtual void saveStatementDraft(const StatementDraftCommand& command) = 0;
270 virtual void clearStatementDraft(const std::string& draftId = {}) = 0;
271
276 virtual void saveImportLog(const ImportLogCommand& command) = 0;
281 virtual void deleteImportLog(const std::string& id) = 0;
286 virtual void saveExportLog(const ExportLogCommand& command) = 0;
291 virtual void deleteExportLog(const std::string& id) = 0;
292};
293
294} // namespace core::ports::workspace
Declares the structured diagnostics reporting port.
Storage manager port used by application services.
Immutable workspace read-model snapshot exposed through workspace ports.
std::function< core::application::workspace::WorkspaceSessionState(const std::string &dbPath)> AtomicStoreLoad
std::function< core::domain::DeletionImpact(const std::string &dbPath, const core::application::workspace::WorkspaceSessionState &document)> AtomicStoreSave
Destroy the storage manager port.
Write-side workspace boundary for persistence, CRUD, drafts, and logs.
virtual std::string addProperty(const PropertyCommand &command)=0
Adds a property from a command.
virtual void updateStatement(const StatementCommand &command)=0
Updates a statement from a command.
virtual std::string addActor(const ActorCommand &command)=0
Adds an actor from a command.
virtual void setSnapshotChangedCallback(SnapshotChanged cb)=0
Registers callback invoked after state changes.
virtual void openFile(const std::string &path)=0
Opens existing workspace file from path.
virtual void saveExportLog(const ExportLogCommand &command)=0
Saves or updates one export log.
virtual void updateAnalysis(const AnalysisCommand &command)=0
Updates an analysis from a command.
virtual std::string addStatementWithTransactions(const StatementWithTransactionsCommand &command)=0
Adds a statement and its transactions as one workspace mutation.
virtual void deleteAnalysis(const std::string &id)=0
Deletes an analysis by identifier.
virtual void notifySnapshot()=0
Publishes the current snapshot without persistence changes.
virtual void clearStatementDraft(const std::string &draftId={})=0
Clears one draft by id or all drafts when id is empty.
virtual ValidationResult validateProperty(const PropertyCommand &command) const =0
Validates a property command without mutating workspace state.
virtual void commit()=0
Commits in-memory state to persistence and publishes snapshot.
virtual void deleteContract(const std::string &id)=0
Deletes a contract by identifier.
virtual ValidationResult validateTransaction(const TransactionCommand &command) const =0
Validates a transaction command without mutating workspace state.
virtual std::string finalizeStatementDraft(const FinalizeStatementDraftCommand &command)=0
Finalizes a statement draft.
virtual void setAtomicStoreLoad(core::ports::storage::IStorageManager::AtomicStoreLoad loadFn)=0
Registers atomic persistence load callback.
virtual std::string addContract(const ContractCommand &command)=0
Adds a contract from a command.
virtual std::string addStatement(const StatementCommand &command)=0
Adds a statement from a command.
virtual void setErrorReporter(std::shared_ptr< core::ports::diagnostics::IErrorReporter > reporter)=0
Registers application error reporter used by workspace operations.
virtual void deleteExportLog(const std::string &id)=0
Deletes one export log by identifier.
virtual void deleteTransaction(const std::string &id)=0
Deletes a transaction by identifier.
virtual void saveImportLog(const ImportLogCommand &command)=0
Saves or updates one import log.
virtual ValidationResult validateContract(const ContractCommand &command) const =0
Validates a contract command without mutating workspace state.
virtual void updateProperty(const PropertyCommand &command)=0
Updates a property from a command.
virtual void saveStatementDraft(const StatementDraftCommand &command)=0
Saves or updates a statement draft from a command.
virtual void saveFileAs(const std::string &path)=0
Saves workspace to specified path.
virtual void deleteProperty(const std::string &id)=0
Deletes a property by identifier.
virtual void newFile(const std::string &path)=0
Creates a new workspace file at path.
virtual ~IWorkspaceWriter()=default
Destroys the workspace writer port.
virtual void deleteImportLog(const std::string &id)=0
Deletes one import log by identifier.
std::function< void(const DeletionImpact &)> DeletionImpactCallback
std::function< void(const WorkspaceSnapshot &)> SnapshotChanged
virtual ValidationResult validateActor(const ActorCommand &command) const =0
Validates an actor command without mutating workspace state.
virtual ValidationResult validateAnalysis(const AnalysisCommand &command) const =0
Validates an analysis command without mutating workspace state.
virtual void setAtomicStoreSave(core::ports::storage::IStorageManager::AtomicStoreSave saveFn)=0
Registers atomic persistence save callback.
virtual std::string addTransaction(const TransactionCommand &command)=0
Adds a transaction from a command.
virtual void deleteStatement(const std::string &id)=0
Deletes a statement by identifier.
virtual void updateAnnual(const AnnualCommand &command)=0
Updates an annual aggregate from a command.
virtual ValidationResult validateStatement(const StatementCommand &command) const =0
Validates a statement command without mutating workspace state.
virtual void updateContract(const ContractCommand &command)=0
Updates a contract from a command.
virtual std::string addAnnual(const AnnualCommand &command)=0
Adds an annual aggregate from a command.
virtual void setDeletionImpactCallback(DeletionImpactCallback cb)=0
Registers deletion impact callback invoked after save operations.
virtual ValidationResult validateStatementWithTransactions(const StatementWithTransactionsCommand &command) const =0
Validates a statement batch command without mutating workspace state.
virtual void deleteActor(const std::string &id)=0
Deletes an actor by identifier.
virtual void openLatest()=0
Opens latest known workspace file.
virtual std::string addAnalysis(const AnalysisCommand &command)=0
Adds an analysis from a command.
virtual ValidationResult validateAnnual(const AnnualCommand &command) const =0
Validates an annual command without mutating workspace state.
virtual void saveFile()=0
Saves workspace to current path.
virtual void updateActor(const ActorCommand &command)=0
Updates an actor from a command.
virtual void updateTransaction(const TransactionCommand &command)=0
Updates a transaction from a command.
virtual void deleteAnnual(const std::string &id)=0
Deletes an annual aggregate by identifier.
Write-side boundary command models for workspace operations.