Rename object record status "deleted" to "archived"

This commit is contained in:
Joshua Ramon Enslin 2024-01-14 03:19:08 +01:00
parent ad237490a3
commit 6c8ca3ac8e
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
2 changed files with 61 additions and 10 deletions

2
l18n

@ -1 +1 @@
Subproject commit a114d7d320e6908f082574982867534b2f6a54d1 Subproject commit 01f7a9e1066c6034e632de89b657a898c4b12837

View File

@ -16,7 +16,7 @@ enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable {
case unlocked; case unlocked;
case locked; case locked;
case revision; case revision;
case deleted; case archived;
/** /**
* Returns a value of this type based on a string. * Returns a value of this type based on a string.
@ -25,13 +25,13 @@ enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable {
* *
* @return MDObjectRecordStatus * @return MDObjectRecordStatus
*/ */
public static function fromString(string $input):MDTagRelationType { public static function fromString(string $input):MDObjectRecordStatus {
return match($input) { return match($input) {
'unlocked' => self::unlocked, 'unlocked' => self::unlocked,
'locked' => self::locked, 'locked' => self::locked,
'revision' => self::revision, 'revision' => self::revision,
'deleted' => self::deleted, 'archived' => self::archived,
default => throw new MDpageParameterNotFromListException("Unknown object record status"), default => throw new MDpageParameterNotFromListException("Unknown object record status"),
}; };
@ -44,13 +44,13 @@ enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable {
* *
* @return MDObjectRecordStatus * @return MDObjectRecordStatus
*/ */
public static function fromInt(int $input):MDTagRelationType { public static function fromInt(int $input):MDObjectRecordStatus {
return match($input) { return match($input) {
0 => self::unlocked, 0 => self::unlocked,
1 => self::locked, 1 => self::locked,
2 => self::revision, 2 => self::revision,
3 => self::deleted, 3 => self::archived,
default => throw new MDpageParameterNotFromListException("Unknown object record status"), default => throw new MDpageParameterNotFromListException("Unknown object record status"),
}; };
@ -61,7 +61,7 @@ enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable {
* *
* @return MDObjectRecordStatus * @return MDObjectRecordStatus
*/ */
public static function getDefault():MDTagRelationType { public static function getDefault():MDObjectRecordStatus {
return self::unlocked; 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 * @return integer
*/ */
@ -113,8 +113,42 @@ enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable {
return match($this) { return match($this) {
self::unlocked => 0, self::unlocked => 0,
self::locked => 1, self::locked => 1,
self::revision > 2, self::revision => 2,
self::deleted => 3, 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"), // 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(). * Provides the option to serialize as a string during json_encode().
* *