Files
KanbanGit/app/Enums/NotificationFilterAttribute.php
T

73 lines
2.2 KiB
PHP

<?php
namespace App\Enums;
enum NotificationFilterAttribute: string
{
case ProjectId = 'project.id';
case ProjectKey = 'project.key';
case ProjectName = 'project.name';
case TicketId = 'ticket.id';
case TicketKey = 'ticket.key';
case TicketTitle = 'ticket.title';
case TicketUrl = 'ticket.url';
case ActorId = 'actor.id';
case ActorName = 'actor.name';
case AssigneeFromId = 'assignee.from.id';
case AssigneeFromName = 'assignee.from.name';
case AssigneeToId = 'assignee.to.id';
case AssigneeToName = 'assignee.to.name';
case StatusFromId = 'status.from.id';
case StatusFromLabel = 'status.from.label';
case StatusToId = 'status.to.id';
case StatusToLabel = 'status.to.label';
public function label(): string
{
return match ($this) {
self::ProjectId => 'Project ID',
self::ProjectKey => 'Project key',
self::ProjectName => 'Project name',
self::TicketId => 'Ticket ID',
self::TicketKey => 'Ticket key',
self::TicketTitle => 'Ticket title',
self::TicketUrl => 'Ticket URL',
self::ActorId => 'Actor ID',
self::ActorName => 'Actor name',
self::AssigneeFromId => 'From assignee ID',
self::AssigneeFromName => 'From assignee name',
self::AssigneeToId => 'To assignee ID',
self::AssigneeToName => 'To assignee name',
self::StatusFromId => 'From status ID',
self::StatusFromLabel => 'From status label',
self::StatusToId => 'To status ID',
self::StatusToLabel => 'To status label',
};
}
/**
* @return array<int, array{label: string, value: string}>
*/
public static function options(): array
{
return array_map(
static fn (self $attribute): array => [
'label' => $attribute->label(),
'value' => $attribute->value,
],
self::cases(),
);
}
/**
* @return array<int, string>
*/
public static function values(): array
{
return array_map(
static fn (self $attribute): string => $attribute->value,
self::cases(),
);
}
}