<?php

namespace App\Jobs;

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

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

    protected $post_id;

    protected $status;

    public $timeout = 30;

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

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