Add notification action foundation

This commit is contained in:
Eric Peters
2026-04-20 21:59:57 +02:00
parent 8df9622f1b
commit e4762f8e32
22 changed files with 1047 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Enums;
enum NotificationChannel: string
{
case Discord = 'discord';
case Webhook = 'webhook';
public function label(): string
{
return match ($this) {
self::Discord => 'Discord',
self::Webhook => 'Webhook',
};
}
/**
* @return array<int, array{label: string, value: string}>
*/
public static function options(): array
{
return array_map(
fn (self $channel): array => [
'label' => $channel->label(),
'value' => $channel->value,
],
self::cases(),
);
}
}
+21
View File
@@ -0,0 +1,21 @@
<?php
namespace App\Enums;
enum NotificationDeliveryStatus: string
{
case Failed = 'failed';
case Pending = 'pending';
case Retryable = 'retryable';
case Succeeded = 'succeeded';
public function label(): string
{
return match ($this) {
self::Failed => 'Failed',
self::Pending => 'Pending',
self::Retryable => 'Retryable',
self::Succeeded => 'Succeeded',
};
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Enums;
enum NotificationEventType: string
{
case TicketStatusChanged = 'ticket_status_changed';
public function label(): string
{
return match ($this) {
self::TicketStatusChanged => 'Ticket status changed',
};
}
/**
* @return array<int, array{label: string, value: string}>
*/
public static function options(): array
{
return array_map(
fn (self $eventType): array => [
'label' => $eventType->label(),
'value' => $eventType->value,
],
self::cases(),
);
}
}