<?php

namespace App\Jobs;

use App\Mail\DrawingForPreliminariesWorks;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Mail;

class SendDrawingEmail implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    protected $emailData;
    protected $toRecipientsEmail;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($emailData, $toRecipientsEmail) {
        $this->emailData = $emailData;
        $this->toRecipientsEmail = $toRecipientsEmail;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle() {
        Mail::to($this->toRecipientsEmail)->queue(new DrawingForPreliminariesWorks($this->emailData));
    }
}
