diff --git a/l18n b/l18n index a114d7d..01f7a9e 160000 --- a/l18n +++ b/l18n @@ -1 +1 @@ -Subproject commit a114d7d320e6908f082574982867534b2f6a54d1 +Subproject commit 01f7a9e1066c6034e632de89b657a898c4b12837 diff --git a/src/enums/MDObjectRecordStatus.php b/src/enums/MDObjectRecordStatus.php index 6b049de..2cb6fb9 100644 --- a/src/enums/MDObjectRecordStatus.php +++ b/src/enums/MDObjectRecordStatus.php @@ -16,7 +16,7 @@ enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable { case unlocked; case locked; case revision; - case deleted; + case archived; /** * Returns a value of this type based on a string. @@ -25,13 +25,13 @@ enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable { * * @return MDObjectRecordStatus */ - public static function fromString(string $input):MDTagRelationType { + public static function fromString(string $input):MDObjectRecordStatus { return match($input) { 'unlocked' => self::unlocked, 'locked' => self::locked, 'revision' => self::revision, - 'deleted' => self::deleted, + 'archived' => self::archived, default => throw new MDpageParameterNotFromListException("Unknown object record status"), }; @@ -44,13 +44,13 @@ enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable { * * @return MDObjectRecordStatus */ - public static function fromInt(int $input):MDTagRelationType { + public static function fromInt(int $input):MDObjectRecordStatus { return match($input) { 0 => self::unlocked, 1 => self::locked, 2 => self::revision, - 3 => self::deleted, + 3 => self::archived, default => throw new MDpageParameterNotFromListException("Unknown object record status"), }; @@ -61,7 +61,7 @@ enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable { * * @return MDObjectRecordStatus */ - public static function getDefault():MDTagRelationType { + public static function getDefault():MDObjectRecordStatus { return self::unlocked; @@ -104,7 +104,7 @@ enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable { } /** - * Returns integer representation of tag relations. + * Returns integer representation of object record status. * * @return integer */ @@ -113,8 +113,42 @@ enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable { return match($this) { self::unlocked => 0, self::locked => 1, - self::revision > 2, - self::deleted => 3, + self::revision => 2, + self::archived => 3, + # default => throw new MDpageParameterNotFromListException("Unknown object record status"), + }; + + } + + /** + * Returns string representation of object record status. + * + * @return string + */ + public function toString():string { + + return match($this) { + self::unlocked => "unlocked", + self::locked => "locked", + self::revision => "revision", + self::archived => "archived", + # default => throw new MDpageParameterNotFromListException("Unknown object record status"), + }; + + } + + /** + * Returns CSS icon class for record status. + * + * @return string + */ + public function toCssIconClass():string { + + return match($this) { + self::unlocked => "iconsLockOpen", + self::locked => "iconsLock", + self::revision => "iconsFolderDelete", + self::archived => "iconsEmojiSymbols", // default => throw new MDpageParameterNotFromListException("Unknown tag relation type"), }; @@ -157,6 +191,23 @@ enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable { } + /** + * Returns whether the status permits an updating of the object record. + * + * @return boolean + */ + public function checkWritingIsEnabled():bool { + + return match($this) { + self::unlocked => true, + self::locked => false, + self::revision => false, + self::archived => false, + # default => throw new MDpageParameterNotFromListException("Unknown object record status"), + }; + + } + /** * Provides the option to serialize as a string during json_encode(). *