<?php

namespace App\Jobs;

use App\Jobs\Job;
use App\User;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\ActivationService as ActivationService;
use Exception;

class SendActivationEmail extends Job implements ShouldQueue, JobEmailSender
{
    use InteractsWithQueue, SerializesModels;

    protected $user;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct(User $user)
    {
        $this->user = $user;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle(ActivationService $activationService)
    {
        $activationService->sendActivationMail($this->user);
    }

    /**
     * Show user email
     * @return string
     */
    public function getUserEmail(){
        return $this->user->email;
    }
}
