<?php

namespace App\Jobs;

use App\Mail\ForecastReadingMail;
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 Illuminate\Support\Facades\Mail;

class ForecastReadingJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * Create a new job instance.
     */
    public $user;
    public $file;
    public function __construct($my_user, $my_file)
    {
        $this->user = $my_user;
        $this->file = $my_file;
    }

    /**
     * Execute the job.
     */
    public function handle(): void
    {
        Mail::send(new ForecastReadingMail($this->user, $this->file));
    }
}
