<?php

namespace App\Modules\HR\PermissionRequests\Notifications;

use App\Modules\HR\PermissionRequests\Models\PermissionRequest;
use App\Support\NotificationCategory;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;

class PermissionRequestRejectedNotification extends Notification implements ShouldQueue
{
    use Queueable;

    public function __construct(
        public readonly PermissionRequest $permissionRequest,
    ) {}

    /**
     * @return list<string>
     */
    public function via(object $notifiable): array
    {
        return ['database'];
    }

    /**
     * @return array<string, mixed>
     */
    public function toArray(object $notifiable): array
    {
        return [
            'category' => NotificationCategory::APPROVALS,
            'type' => 'permission_request_rejected',
            'permission_request_id' => $this->permissionRequest->id,
            'title' => __('permission_requests.notifications.rejected_title'),
            'body' => __('permission_requests.notifications.rejected_body', [
                'id' => $this->permissionRequest->id,
            ]),
        ];
    }
}
