feat: add getLabel method to SignRequestStatus enum

Add a getLabel() method to the SignRequestStatus enum to provide
localized status labels (Draft, Pending, Signed). This follows the
same pattern as DocMdpLevel enum and centralizes the translation
logic in the enum itself rather than spreading it across multiple
files.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This commit is contained in:
Vitor Mattos 2025-12-11 14:28:17 -03:00
parent 453b200bcf
commit e3ad25951a
No known key found for this signature in database
GPG key ID: 6FECE2AD4809003A

View file

@ -9,8 +9,21 @@ declare(strict_types=1);
namespace OCA\Libresign\Enum;
use OCP\IL10N;
enum SignRequestStatus: int {
case DRAFT = 0;
case ABLE_TO_SIGN = 1;
case SIGNED = 2;
public function getLabel(IL10N $l10n): string {
return match($this) {
// TRANSLATORS Name of the status when signer document is in draft state
self::DRAFT => $l10n->t('Draft'),
// TRANSLATORS Name of the status when signer can sign the document
self::ABLE_TO_SIGN => $l10n->t('Pending'),
// TRANSLATORS Name of the status when signer has already signed
self::SIGNED => $l10n->t('Signed'),
};
}
}