17 name_ = std::move(value.
value());
25 type_ = std::move(value.
value());
34 std::transform(normalized.begin(), normalized.end(), normalized.begin(), [](
unsigned char c) {
35 return static_cast<char>(std::tolower(c));
37 if (normalized ==
"all")
39 if (normalized !=
"mixed" && normalized !=
"allocatable" && normalized !=
"non-allocatable")
41 allocatableMode_ = std::move(normalized);
46 actorIds_ = std::move(value);
54 actorIds_.push_back(std::move(value));
59 actorIds_.erase(std::remove(actorIds_.begin(), actorIds_.end(), normalized), actorIds_.end());
68 propertyIds_ = std::move(value);
76 propertyIds_.push_back(std::move(value));
81 propertyIds_.erase(std::remove(propertyIds_.begin(), propertyIds_.end(), normalized), propertyIds_.end());
90 aliases_ = std::move(value);
98 aliases_.push_back(std::move(value));
111 return !name_.empty();
119 return aliases_.size();
123 return !aliases_.empty();
132 return std::find(actorIds_.begin(), actorIds_.end(), normalized) != actorIds_.end();
137 return std::find(propertyIds_.begin(), propertyIds_.end(), normalized) != propertyIds_.end();
141 return actorIds_.size() == 1u;
145 return !actorIds_.empty();
149 return !propertyIds_.empty();
153 return !actorIds_.empty() || !propertyIds_.empty();
157 return actorIds_.size() + propertyIds_.size();
161 return actorIds_.size();
165 return propertyIds_.size();
169 return !type_.empty();
Domain model for contracts.
const std::string & value() const noexcept
void setAliases(std::vector< Alias > value)
std::size_t relationCount() const noexcept
Returns the total number of linked relations.
bool hasAlias(const std::string &value) const
Checks whether an alias exists on the contract.
const std::vector< Alias > & aliases() const noexcept
bool hasRelations() const noexcept
Checks whether the contract has any relations.
void setType(ContractType value)
Sets the contract type from a normalized value object.
std::size_t propertyCount() const noexcept
Returns the number of linked properties.
bool hasName() const noexcept
Checks whether the contract has a name.
bool hasActorRelations() const noexcept
Checks whether any actor relations exist.
void clearAliases()
Clears all aliases from the contract.
void addAlias(Alias value)
Adds a normalized alias when it is not already present.
void setId(std::string value)
std::size_t actorCount() const noexcept
Returns the number of linked actors.
bool containsActorId(const std::string &value) const
Checks whether an actor id exists.
bool hasType() const noexcept
Checks whether the contract has a type.
bool containsPropertyId(const std::string &value) const
Checks whether a property id exists.
void removeAlias(std::string value)
Removes an alias.
void addActorId(std::string value)
Adds an actor id when it is not already present.
void removePropertyId(const std::string &value)
Removes a property id from the contract.
void clearPropertyIds()
Clears all linked property ids.
bool isConfigured() const noexcept
Checks whether the contract is fully configured.
void clearActorIds()
Clears all linked actor ids.
const std::string & name() const noexcept
void setCreatedAt(std::string value)
const std::string & allocatableMode() const noexcept
void setActorIds(std::vector< std::string > value)
Replaces the linked actor ids with normalized values.
void removeActorId(const std::string &value)
Removes an actor id from the contract.
const std::string & id() const noexcept
bool hasPropertyRelations() const noexcept
Checks whether any property relations exist.
void setUpdatedAt(std::string value)
void setPropertyIds(std::vector< std::string > value)
Replaces the linked property ids with normalized values.
void addPropertyId(std::string value)
Adds a property id when it is not already present.
bool isMatchingReady() const noexcept
Checks whether the contract is ready for matching.
void recordAliasHit(std::string value, std::string timestamp={})
Records a usage hit for an alias.
std::size_t aliasCount() const noexcept
Returns the number of aliases.
const std::string & updatedAt() const noexcept
bool hasAliases() const noexcept
Checks whether the contract has any aliases.
const std::string & type() const noexcept
void rename(EntityName value)
Renames the contract with normalized entity text.
bool hasSingleActor() const noexcept
Checks whether the contract has exactly one actor.
void setAllocatableMode(std::string value)
const std::vector< std::string > & actorIds() const noexcept
bool isStandalone() const noexcept
Checks whether the contract has no actor or property links.
const std::string & createdAt() const noexcept
const std::vector< std::string > & propertyIds() const noexcept
const std::string & value() const noexcept
const std::string & value() const noexcept
std::string canonicalAliasValue(std::string value)
Canonicalizes an alias string for comparison.
void recordAliasHit(std::vector< Alias > &aliases, const std::string &value, const std::string ×tamp={})
Records or updates a hit for an alias value.
std::string trimCopy(std::string value)
Trims leading and trailing whitespace from text.
void normalizeAliases(std::vector< Alias > &aliases)
Normalizes and deduplicates a list of aliases.
bool containsAliasValue(const std::vector< Alias > &aliases, const std::string &value)
Checks whether an alias list already contains a value.
void removeAliasValue(std::vector< Alias > &aliases, const std::string &value)
Removes aliases with a given value.
void normalizeAlias(Alias &alias)
Normalizes a single alias in place.