<?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 PermissionRequestApprovedNotification 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_approved',
            'permission_request_id' => $this->permissionRequest->id,
            'title' => __('permission_requests.notifications.approved_title'),
            'body' => __('permission_requests.notifications.approved_body', [
                'id' => $this->permissionRequest->id,
            ]),
        ];
    }
}
