<?php

namespace App\Classes\Jobs;

use App\Classes\Modules\Segments\Processors\RiskAnalysisProcessor;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

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


    /** @var User */
    private $user;

    /** @var string */
    private $captchaToken;

    /**
     * UserRiskAnalysis constructor.
     * @param User $user
     * @param string $captchaToken
     */
    public function __construct(User $user, string $captchaToken)
    {
        $this->user = $user;
        $this->captchaToken = $captchaToken;
    }


    public function handle()
    {
        (app()->make(RiskAnalysisProcessor::class))->execute($this->user, $this->captchaToken);
    }
}
