php-tenant/Enums/WorkspaceMemberRole.php

42 lines
817 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace Core\Tenant\Enums;
/**
* Workspace member roles.
*
* Backed enum replacing the legacy string constants on WorkspaceMember.
*/
enum WorkspaceMemberRole: string
{
case OWNER = 'owner';
case ADMIN = 'admin';
case MEMBER = 'member';
/**
* Get a human-readable label for the role.
*/
public function label(): string
{
return match ($this) {
self::OWNER => 'Owner',
self::ADMIN => 'Admin',
self::MEMBER => 'Member',
};
}
/**
* Get the colour for this role's badge.
*/
public function colour(): string
{
return match ($this) {
self::OWNER => 'violet',
self::ADMIN => 'blue',
self::MEMBER => 'zinc',
};
}
}