<?php

namespace App\Http\Controllers\Tests;

use App\Helpers\FirstParty\DFS\DFSBacklinks;
use App\Helpers\FirstParty\DFS\DFSCommon;
use App\Helpers\FirstParty\DFS\DFSOnPage;
use App\Http\Controllers\Controller;
use App\Jobs\SaveDFSToCandidateDomainsJob;
use Illuminate\Http\Request;

class GeneralTestController extends Controller
{
    public function onPageList(Request $request)
    {
        $response = DFSOnPage::listId(7);

        $tasks = DFSCommon::getTasks($response);

        foreach ($tasks as $task) {
            $task_result = DFSCommon::getTaskResult($task);

            dump($task_result);
        }
    }

    public function processBacklinks(Request $request)
    {
        SaveDFSToCandidateDomainsJob::dispatch()->onConnection('default')->onQueue('default');
    }

    public function backlinks(Request $request)
    {
        $dfs_results = DFSBacklinks::backlinksPaginationLive('topai.tools', null);

        dd($dfs_results);
    }
}
