<?php

namespace App\Modules\HR\Loans\Notifications;

use App\Modules\HR\Loans\Models\Loan;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;

class LoanApprovedNotification extends Notification
{
    use Queueable;

    public function __construct(private readonly Loan $loan) {}

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

    /** @return array<string, mixed> */
    public function toArray(object $notifiable): array
    {
        return [
            'type' => 'loan_approved',
            'loan_id' => $this->loan->id,
            'amount' => $this->loan->amount,
            'message' => __('loans.notifications.approved'),
            'url' => route('me.loans.index'),
        ];
    }
}
