Add notification action foundation
This commit is contained in:
@@ -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(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user