<?php

namespace App\Jobs;

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

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

    protected $post_id;

    public $timeout = 10;

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

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