<?php

namespace App\Notifications;

use App\Models\JobApplication;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class CvScanFailedNotification extends Notification
{
    use Queueable;

    public function __construct(
        protected JobApplication $application,
        protected string $message,
        protected string $type = 'failed'
    ) {}

    public function via(object $notifiable): array
    {
        return ['database'];
    }

    public function toArray(object $notifiable): array
    {
        $isLimit = $this->type === 'limit';

        return [
            'type'           => $isLimit ? 'cv_scan_limit' : 'cv_scan_failed',
            'title'          => $isLimit
                ? 'VirusTotal Günlük Limit Doldu'
                : 'CV Tarama Başarısız',
            'message'        => $this->message,
            'application_id' => $this->application->id,
            'applicant_name' => $this->application->full_name,
            'url'            => '/admin/basvurular/' . $this->application->id,
        ];
    }
}