<?php

namespace App\Classes\Jobs;

use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Modules\Accounts\Services\ExpiresEmailVerificationAttempt;
use App\Classes\Modules\Accounts\Services\ExpiresPasswordReset;
use App\Models\PasswordReset;
use App\Models\UserEmailVerification;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

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


    /** @var UserEmailVerification */
    private $attempt;

    /**
     * EmailVerificationAttemptExpiration constructor.
     * @param UserEmailVerification $attempt
     */
    public function __construct(UserEmailVerification $attempt)
    {
        $this->attempt = $attempt;
    }


    /**
     * @throws MalformedRequestException
     */
    public function handle()
    {
        (new ExpiresEmailVerificationAttempt())->execute($this->attempt);

    }
}
