<?php

namespace App\Jobs;

use App\Mail\SendQuoteInfoMail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;
use App\Mail\SendMail;

class SendMailJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    
    
    public function __construct(
        private string $reciever,
        private string $mailableClass,
        private string $view,
        private string $subject,
        private $data,
    ){}

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        Mail::to($this->reciever)
        ->send
        (
            new $this->mailableClass
            ($this->data,$this->view,$this->subject)
        );
    }
}
