<?php

namespace App\Jobs;

use App\Jobs\Tasks\GetUrlBodyTask;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

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

    protected $url_to_crawl_id;

    public $timeout = 60;

    /**
     * Create a new job instance.
     */
    public function __construct($url_to_crawl_id)
    {
        $this->url_to_crawl_id = $url_to_crawl_id;
    }

    /**
     * Execute the job.
     */
    public function handle(): void
    {
        GetUrlBodyTask::handle($this->url_to_crawl_id);
    }
}
