16 std::
string bookingDateValue,
17 std::
string valutaValue,
19 bool allocatableValue)
20 : amount_(amountValue),
21 allocatable_(allocatableValue) {
28 name_ = std::move(value.
value());
36 bookingDate_ = std::move(value.
value());
48 amount_ = value.
value();
92 return status_ == value;
96 return !statementId_.empty();
100 return !contractId_.empty();
104 return !actorId_.empty();
108 return !propertyIds_.empty();
112 return propertyIds_.size();
151 propertyIds_ = std::move(value);
159 propertyIds_.push_back(std::move(value));
164 propertyIds_.erase(std::remove(propertyIds_.begin(), propertyIds_.end(), normalized), propertyIds_.end());
169 return std::find(propertyIds_.begin(), propertyIds_.end(), normalized) != propertyIds_.end();
Domain model for transactions.
const std::string & value() const noexcept
const std::string & value() const noexcept
double value() const noexcept
bool hasRelations() const noexcept
Checks whether the transaction has any relations.
void clearActor()
Clears the linked actor id.
void setAmount(MoneyAmount value)
Sets the amount from a value object.
void setStatementId(std::string value)
Sets the statement id.
bool isStandalone() const noexcept
Checks whether the transaction is standalone.
void removePropertyId(const std::string &value)
Removes a property id from the transaction.
void setActorId(std::string value)
Sets the actor id.
bool containsPropertyId(const std::string &value) const
Checks whether a property id exists.
bool hasStatus(Status value) const noexcept
Checks whether the transaction has a given status.
void clearProperties()
Clears linked property ids.
void setName(EntityName value)
Sets the transaction name from a value object.
void setStatus(Status value)
Sets the transaction status.
void setValuta(std::string value)
Sets the valuta text.
void setContractId(std::string value)
Sets the contract id.
std::size_t propertyCount() const noexcept
Returns the number of linked properties.
const std::string & id() const noexcept
bool hasProperties() const noexcept
Checks whether the transaction is linked to properties.
const std::string & name() const noexcept
const std::vector< std::string > & propertyIds() const noexcept
const std::string & statementId() const noexcept
void markVerified()
Advances the transaction to verified status when allowed.
void setPropertyIds(std::vector< std::string > value)
Replaces the property id list with normalized values.
const std::string & actorId() const noexcept
void addPropertyId(std::string value)
Adds a property id when it is not already present.
const std::string & updatedAt() const noexcept
bool belongsToStatement(const std::string &value) const
Checks whether the transaction belongs to a statement.
bool isAllocatable() const noexcept
Checks whether the transaction can be allocated.
const std::string & createdAt() const noexcept
const std::string & bookingDate() const noexcept
const std::string & valuta() const noexcept
void markUnverified()
Advances the transaction to unverified status when allowed.
void markCompleted()
Advances the transaction to completed status when allowed.
bool hasActor() const noexcept
Checks whether the transaction is linked to an actor.
bool hasStatement() const noexcept
Checks whether the transaction is linked to a statement.
const Status & status() const noexcept
void setCreatedAt(std::string value)
void setBookingDate(BookingDate value)
Sets the booking date from a value object.
void setId(std::string value)
void setUpdatedAt(std::string value)
void setAllocatable(bool value)
Sets the allocatable flag.
bool hasContract() const noexcept
Checks whether the transaction is linked to a contract.
const double & amount() const noexcept
const std::string & contractId() const noexcept
void clearContract()
Clears the linked contract id.
void clearStatement()
Clears the linked statement id.
bool statusCanAdvance(int current, int next)
Checks whether a transaction status may advance.
void normalizeIds(std::vector< std::string > &values)
Normalizes and deduplicates relation ids.
std::string normalizeId(std::string value)
Normalizes a relation id.
std::string normalizeText(std::string value)
Normalizes free-form transaction text.